{"record":{"id":"01d388b57e2e2793","repo":"rolldown/rolldown","slug":"a-string-id-filter-is-not-supported-for-the-h","errorCode":null,"errorMessage":"A string `id` filter is not supported for the `${hookName}` hook, because its `id` is the import specifier rather than a resolved path. Use a RegExp instead.","messagePattern":"A string `id` filter is not supported for the `(.+?)` hook, because its `id` is the import specifier rather than a resolved path\\. Use a RegExp instead\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/rolldown/src/plugin/bindingify-hook-filter.ts","lineNumber":162,"sourceCode":"    case 'or':\n      return expr.args.some(containsStringId);\n    case 'not':\n    case 'include':\n    case 'exclude':\n      return containsStringId(expr.expr);\n    case 'id':\n      return typeof expr.pattern === 'string';\n    default:\n      return false;\n  }\n}\n\nfunction assertNoStringId(\n  filterExprs: filter.TopLevelFilterExpression[] | undefined,\n  hookName: string,\n): void {\n  if (filterExprs?.some(containsStringId)) {\n    throw new Error(\n      `A string \\`id\\` filter is not supported for the \\`${hookName}\\` hook, because its \\`id\\` is the import specifier rather than a resolved path. Use a RegExp instead.`,\n    );\n  }\n}\n\nfunction bindingifyFilterExprImpl(\n  expr: FilterExpression | TopLevelFilterExpression,\n  list: BindingFilterToken[],\n) {\n  switch (expr.kind) {\n    case 'and': {\n      let args = expr.args;\n      for (let i = args.length - 1; i >= 0; i--) {\n        bindingifyFilterExprImpl(args[i], list);\n      }\n      list.push({\n        kind: 'And',\n        payload: args.length,","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/rolldown/rolldown/blob/91b44b9d7bcfb5725533478e044e3891a251b2c5/packages/rolldown/src/plugin/bindingify-hook-filter.ts#L144-L180","documentation":"For the resolveId hook the `id` being filtered is the raw import specifier, not a resolved filesystem path, so a string `id` filter would compare against unpredictable specifier text. Rolldown rejects this combination with this Error, advising a RegExp for partial/specifier matching; string ids remain valid for hooks whose id is a resolved path.","triggerScenarios":"Defining a plugin whose resolveId `filter` contains a string `id` (exact string matcher, e.g. id: 'some-module') — bindingifyResolveIdFilter calls assertNoStringId and throws at registration.","commonSituations":"Reusing a load/transform filter shape for resolveId; trying to exactly match a specifier by string, not realizing specifiers may be relative, aliased, or bare; migrating plugins between bundler APIs with different filter semantics.","solutions":["Change the string id filter to a RegExp that matches the specifier (e.g. id: /^some-module$/ or id: /some-module/)","Move the exact-match logic into the resolveId handler body instead of the filter","Keep string id filters only for hooks where id is a resolved path (load, transform, etc.)"],"exampleFix":"// before\nresolveId: {\n  filter: { id: 'virtual:my-module' },\n  handler() { ... }\n}\n// after\nresolveId: {\n  filter: { id: /^virtual:my-module$/ },\n  handler() { ... }\n}","handlingStrategy":"validation","validationCode":"function validateResolveIdFilter(filter) {\n  if (typeof filter?.id === 'string') {\n    throw new Error('resolveId id filter must be a RegExp, not a string');\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  registerPlugin(pluginWithResolveId);\n} catch (e) {\n  if (String(e).includes('string `id` filter')) {\n    console.error('Convert the string id filter to a RegExp for resolveId');\n  } else throw e;\n}","preventionTips":["Use RegExp id filters for resolveId since ids are raw specifiers","Keep exact string matching for resolved-path hooks (load/transform)","Test plugin registration in a unit test so filter-shape errors surface before builds"],"tags":["plugin-api","filter","resolveid","config"],"backgroundTag":"invalid-config-value","analyzedSha":"91b44b9d7bcfb5725533478e044e3891a251b2c5","analyzedAt":"2026-09-07T16:04:13.504Z","contentChangedAt":"2026-09-07T16:04:13.504Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}