{"record":{"id":"cd45f556ea772dd3","repo":"withastro/astro","slug":"plugincontentimportserror","errorCode":"PluginContentImportsError","errorMessage":"Unexpected error processing content collection data.","messagePattern":"Unexpected error processing content collection data\\.","errorType":"error_code","errorClass":"AstroError","httpStatus":null,"severity":"error","filePath":"packages/astro/src/content/vite-plugin-content-imports.ts","lineNumber":440,"sourceCode":"\t\t\t\treturn `new URL(${JSON.stringify(value.href)})`;\n\t\t\t}\n\n\t\t\t// For Astro assets, add a proxy to track references\n\t\t\tif (typeof value === 'object' && 'ASTRO_ASSET' in value) {\n\t\t\t\tconst { ASTRO_ASSET, ...asset } = value;\n\t\t\t\tasset.fsPath = ASTRO_ASSET;\n\t\t\t\treturn getProxyCode(asset, isSSR);\n\t\t\t}\n\t\t});\n\t} catch (e) {\n\t\tif (e instanceof Error) {\n\t\t\tthrow new AstroError({\n\t\t\t\t...AstroErrorData.UnsupportedConfigTransformError,\n\t\t\t\tmessage: AstroErrorData.UnsupportedConfigTransformError.message(e.message),\n\t\t\t\tstack: e.stack,\n\t\t\t});\n\t\t} else {\n\t\t\tthrow new AstroError({\n\t\t\t\tname: 'PluginContentImportsError',\n\t\t\t\tmessage: 'Unexpected error processing content collection data.',\n\t\t\t});\n\t\t}\n\t}\n}\n","sourceCodeStart":422,"sourceCodeEnd":447,"githubUrl":"https://github.com/withastro/astro/blob/d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca/packages/astro/src/content/vite-plugin-content-imports.ts#L422-L447","documentation":"A fallback error thrown when the content imports plugin's data processing catches a non-Error value (e.g. a string, number, or null thrown by a third-party library). Since `instanceof Error` is false, the code can't extract a message or stack, so it throws a generic `PluginContentImportsError`. This is distinct from error 109 which handles actual Error instances during the same operation.","triggerScenarios":"Code inside the `stringify`/processing pipeline throws a non-Error value (e.g. `throw 'bad value'` or `throw 42`). The catch block's `else` branch fires, creating a plain AstroError with name 'PluginContentImportsError' and message 'Unexpected error processing content collection data.'","commonSituations":"A third-party content loader or parser throws a non-Error. A custom transform or schema validation function throws a bare string. An internal Astro bug where an assertion fails by throwing a non-Error. A malformed devalue plugin throws a primitive.","solutions":["Check the console/dev-server output for any preceding error that may have triggered this.","Review custom loaders, parsers, and transforms for `throw` statements that throw non-Error values — change them to `throw new Error(...)`.","Disable custom integrations one by one to isolate the source.","File an Astro issue if no custom code is involved, including the full build log."],"exampleFix":"// before — custom loader\nfunction myParser(raw) {\n  if (!raw) throw 'empty input'; // non-Error throw\n  return JSON.parse(raw);\n}\n\n// after\nfunction myParser(raw) {\n  if (!raw) throw new Error('empty input');\n  return JSON.parse(raw);\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await processContent();\n} catch (e) {\n  if (e instanceof Error && e.name === 'PluginContentImportsError') {\n    console.error('Unexpected non-Error throw in content pipeline');\n  }\n  throw e;\n}","preventionTips":["Always throw new Error() in custom loaders/parsers, never bare values.","Wrap third-party code that may throw non-Error values in try-catch.","Log the full pipeline context when debugging to find the originating throw."],"tags":["content-collections","error-handling","vite","plugin"],"backgroundTag":null,"analyzedSha":"d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca","analyzedAt":"2026-08-12T13:37:29.035Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}