{"record":{"id":"57a86211d6dd3926","repo":"gatsbyjs/gatsby","slug":"pluginname-created-a-slice-and-didn-t-pass-the","errorCode":null,"errorMessage":"${pluginName} created a slice and didn't pass the path to the component","messagePattern":"(.+?) created a slice and didn't pass the path to the component","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby/src/redux/actions/restricted.ts","lineNumber":501,"sourceCode":"      const { slices } = store.getState()\n\n      const { error, panicOnBuild } = validateComponent({\n        input: payload,\n        pluginName: name,\n        errorIdMap: {\n          noPath: `11333`,\n          notAbsolute: `11335`,\n          doesNotExist: `11336`,\n          empty: `11337`,\n          noDefaultExport: `11338`,\n        },\n      })\n\n      if (error && process.env.NODE_ENV !== `test`) {\n        if (panicOnBuild) {\n          report.panicOnBuild(error)\n        } else {\n          report.panic(error)\n        }\n      }\n\n      const componentPath = normalizePath(payload.component)\n\n      const oldSlice = slices.get(payload.id)\n      const contextModified =\n        !!oldSlice && !isEqual(oldSlice.context, payload.context)\n      const componentModified =\n        !!oldSlice && !isEqual(oldSlice.componentPath, componentPath)\n\n      return {\n        type: `CREATE_SLICE`,\n        plugin,\n        payload: {\n          componentChunkName: generateComponentChunkName(\n            payload.component,\n            `slice`","sourceCodeStart":483,"sourceCodeEnd":519,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/packages/gatsby/src/redux/actions/restricted.ts#L483-L519","documentation":"Thrown by createSlice when validateComponent returns an error for the slice component (no path / not absolute / does not exist / empty / no default export, codes 11333/11335/11336/11337/11338) and the error does not set panicOnBuild, so report.panic runs. Mirrors the createPage component validation but for slice components. Skipped when NODE_ENV==='test'.","triggerScenarios":"payload.component fails validateComponent (missing, relative, non-existent, empty, or no default export) and panicOnBuild is false.","commonSituations":"Passing a relative path for the slice component; typo in filename; a slice component file with no default export; case mismatch surfaced by trueCasePathSync on Linux CI.","solutions":["Pass an absolute path via path.resolve for the slice component.","Ensure the file exists with the exact casing used in code.","Ensure the component file has a default export.","Check the specific validateComponent error code (11333-11338) printed in the message for the precise failure."],"exampleFix":"// before\nactions.createSlice({ id: `header`, component: `./src/slices/header.js` })\n// after\nactions.createSlice({ id: `header`, component: path.resolve(`./src/slices/header.js`) })\n// src/slices/header.js\nexport default () => <header>...</header>","handlingStrategy":"validation","validationCode":"const path = require('path'), fs = require('fs')\nconst abs = path.isAbsolute(payload.component) ? payload.component : path.resolve(payload.component)\nif (!fs.existsSync(abs)) throw new Error(`Slice component not found: ${abs}`)\nactions.createSlice({ ...payload, component: abs })","typeGuard":"function isAbsoluteExistingSliceComponent(p: string): boolean {\n  return typeof p === 'string' && path.isAbsolute(p) && require('fs').existsSync(p)\n}","tryCatchPattern":null,"preventionTips":["Always resolve slice component paths to absolute.","Match file casing exactly (case-sensitive on Linux CI).","Ensure each slice component has a default export.","Guard createSlice calls behind an existence check during dynamic generation."],"tags":["slices","createslice","component","path","validation"],"backgroundTag":null,"analyzedSha":"8b06340921ffdf23125a365b9c9923690cb62ce6","analyzedAt":"2026-08-13T02:36:21.405Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}