You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: packages/gatsby-cli/src/structured-errors/error-map.ts
+43-2
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,7 @@ const errors = {
29
29
`"${context.ref}" is not available during server side rendering.`,
30
30
level: Level.ERROR,
31
31
docsUrl: `https://gatsby.dev/debug-html`,
32
+
category: ErrorCategory.USER,
32
33
},
33
34
"95313": {
34
35
text: (context): string=>
@@ -51,6 +52,7 @@ const errors = {
51
52
`${context.stageLabel} failed\n\n${context.sourceMessage}\n\nIf you're trying to use a package make sure that '${context.packageName}' is installed. If you're trying to use a local file make sure that the path is correct.`,
`String interpolation is not allowed in graphql tag:\n\n${context.codeFrame}`,
149
154
type: Type.GRAPHQL,
150
155
level: Level.ERROR,
156
+
category: ErrorCategory.USER,
151
157
},
152
158
"85917": {
153
159
text: (context): string=>
@@ -165,6 +171,7 @@ const errors = {
165
171
}`),
166
172
type: Type.GRAPHQL,
167
173
level: Level.ERROR,
174
+
category: ErrorCategory.USER,
168
175
},
169
176
// Duplicate fragment
170
177
"85919": {
@@ -180,6 +187,7 @@ const errors = {
180
187
`),
181
188
type: Type.GRAPHQL,
182
189
level: Level.ERROR,
190
+
category: ErrorCategory.USER,
183
191
},
184
192
// Undefined variables in Queries
185
193
"85920": {
@@ -206,24 +214,37 @@ const errors = {
206
214
},
207
215
type: Type.GRAPHQL,
208
216
level: Level.ERROR,
217
+
category: ErrorCategory.USER,
209
218
},
210
219
"85921": {
211
220
text: (context): string=>
212
221
`There was an error in your GraphQL query:\n\n${context.sourceMessage}\n\nIf you're e.g. filtering for specific nodes make sure that you choose the correct field (that has the same type "${context.inputType}") or adjust the context variable to the type "${context.expectedType}".`,
213
222
type: Type.GRAPHQL,
214
223
level: Level.ERROR,
224
+
category: ErrorCategory.USER,
215
225
},
216
226
"85922": {
217
227
text: (context): string=>
218
-
`There was an error in your GraphQL query:\n\n${context.sourceMessage}\n\nThis can happen if you e.g. accidentally added { } to the field "${context.fieldName}". If you didn't expect "${context.fieldName}" to be of type "${context.fieldType}" make sure that your input source and/or plugin is correct.`,
228
+
`There was an error in your GraphQL query:
229
+
230
+
${context.sourceMessage}
231
+
232
+
This can happen if you e.g. accidentally added { } to the field "${context.fieldName}". If you didn't expect "${context.fieldName}" to be of type "${context.fieldType}" make sure that your input source and/or plugin is correct.
233
+
However, if you expect "value" to exist, the field might be accessible in another subfield. Please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have.
234
+
235
+
It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned
236
+
"dummy content". Visit our docs to learn how you can define the schema for "${context.type}":
`There was an error in your GraphQL query:\n\n${context.sourceMessage}\n\nIf you don't expect "${context.field}" to exist on the type "${context.type}" it is most likely a typo.\nHowever, if you expect "${context.field}" to exist there are a couple of solutions to common problems:\n\n- If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server\n- The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have\n- You want to optionally use your field "${context.field}" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add at least one entry with that field ("dummy content")\n\nIt is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "${context.type}":\nhttps://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions`,
225
245
type: Type.GRAPHQL,
226
246
level: Level.ERROR,
247
+
category: ErrorCategory.USER,
227
248
},
228
249
"85924": {
229
250
text: (context): string=>
@@ -236,6 +257,7 @@ const errors = {
236
257
}".${optionalGraphQLInfo(context)}`,
237
258
type: Type.GRAPHQL,
238
259
level: Level.ERROR,
260
+
category: ErrorCategory.USER,
239
261
},
240
262
"85925": {
241
263
text: (context): string=>
@@ -248,43 +270,50 @@ const errors = {
248
270
)}`,
249
271
type: Type.GRAPHQL,
250
272
level: Level.ERROR,
273
+
category: ErrorCategory.USER,
251
274
},
252
275
"85926": {
253
276
text: (context): string=>
254
277
`There was an error in your GraphQL query:\n\n${context.sourceMessage}\n\nThis can happen when you used graphql\`{ ...yourQuery }\` instead of graphql(\`{ ...yourQuery }\`) inside gatsby-node.js\n\nYou can't use the template literal function you're used to (from page queries) and rather have to call graphql() as a normal function.`,
255
278
type: Type.GRAPHQL,
256
279
level: Level.ERROR,
280
+
category: ErrorCategory.USER,
257
281
},
258
282
"85927": {
259
283
text: (context): string=>
260
284
`There was an error in your GraphQL query:\n\n${context.sourceMessage}\n\nSee if ${context.variable} has a typo or ${context.operation} doesn't actually require this variable.`,
`We encountered an error while trying to load your site's ${context.configName}. Please fix the error and try again.`,
274
300
type: Type.CONFIG,
275
301
level: Level.ERROR,
302
+
category: ErrorCategory.USER,
276
303
},
277
304
"10124": {
278
305
text: (context): string=>
279
306
`It looks like you were trying to add the config file? Please rename "${context.nearMatch}" to "${context.configName}.js"`,
280
307
type: Type.CONFIG,
281
308
level: Level.ERROR,
309
+
category: ErrorCategory.USER,
282
310
},
283
311
"10125": {
284
312
text: (context): string=>
285
313
`Your ${context.configName} file is in the wrong place. You've placed it in the src/ directory. It must instead be at the root of your site next to your package.json file.`,
286
314
type: Type.CONFIG,
287
315
level: Level.ERROR,
316
+
category: ErrorCategory.USER,
288
317
},
289
318
"10126": {
290
319
text: (context): string=>
@@ -295,6 +324,7 @@ const errors = {
295
324
`\nare not supported in the root gatsby-config.`,
296
325
type: Type.CONFIG,
297
326
level: Level.ERROR,
327
+
category: ErrorCategory.USER,
298
328
},
299
329
"10226": {
300
330
text: (context): string=>
@@ -332,6 +362,7 @@ const errors = {
332
362
4
333
363
)}\n\nSee the documentation for the "createPage" action — https://www.gatsbyjs.org/docs/actions/#createPage`,
334
364
level: Level.ERROR,
365
+
category: ErrorCategory.USER,
335
366
},
336
367
"11323": {
337
368
text: (context): string=>
@@ -343,6 +374,7 @@ const errors = {
343
374
4
344
375
)}\n\nSee the documentation for the "createPage" action — https://www.gatsbyjs.org/docs/actions/#createPage`,
345
376
level: Level.ERROR,
377
+
category: ErrorCategory.USER,
346
378
},
347
379
"11324": {
348
380
text: (context): string=>
@@ -361,6 +393,7 @@ const errors = {
361
393
4
362
394
)}\n\nSee the documentation for the "createPage" action — https://www.gatsbyjs.org/docs/actions/#createPage`,
363
395
level: Level.ERROR,
396
+
category: ErrorCategory.USER,
364
397
},
365
398
"11326": {
366
399
text: (context): string=>
@@ -376,16 +409,19 @@ const errors = {
376
409
4
377
410
)}\n\nSee the documentation for the "createPage" action — https://www.gatsbyjs.org/docs/actions/#createPage`,
378
411
level: Level.ERROR,
412
+
category: ErrorCategory.USER,
379
413
},
380
414
"11327": {
381
415
text: (context): string=>
382
416
`You have an empty file in the "src/pages" directory at "${context.relativePath}". Please remove it or make it a valid component`,
383
417
level: Level.ERROR,
418
+
category: ErrorCategory.USER,
384
419
},
385
420
"11328": {
386
421
text: (context): string=>
387
422
`A page component must export a React component for it to be valid. Please make sure this file exports a React component:\n\n${context.fileName}`,
0 commit comments