{"record":{"id":"16fbd9a9ba1b5071","repo":"deepseek-ai/deepseek-harness","slug":"invariants-field-contains-invalid-regex-json","errorCode":null,"errorMessage":"invariants: ${field} contains invalid regex ${JSON.stringify(value)}","messagePattern":"invariants: (.+?) contains invalid regex (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/runtime-diagnostics/invariants/src/index.ts","lineNumber":88,"sourceCode":"    invariants: InvariantRegistry\n  }\n}\n\n/** Compile and validate one package-filter list. */\nfunction compilePatterns(field: 'package_allowlist' | 'package_blocklist', values: readonly string[]): RegExp[] {\n  const seen = new Set<string>()\n  return values.map((value) => {\n    if (value.length === 0 || value.trim() !== value) {\n      throw new Error(`invariants: ${field} entries must be non-blank and have no surrounding whitespace`)\n    }\n    if (seen.has(value)) {\n      throw new Error(`invariants: ${field} contains duplicate regex ${JSON.stringify(value)}`)\n    }\n    seen.add(value)\n    try {\n      return new RegExp(value)\n    } catch (cause) {\n      throw new Error(`invariants: ${field} contains invalid regex ${JSON.stringify(value)}`, { cause })\n    }\n  })\n}\n\n/** Package-owned invariant registry with global and regex-based selection. */\nexport class InvariantRegistry extends Service {\n  static Config: Schema<Config> = z.object({\n    enabled: z.boolean().default(true),\n    package_allowlist: z.array(z.string()).default([]),\n    package_blocklist: z.array(z.string()).default([]),\n  })\n\n  private readonly enabled: boolean\n  private readonly ownerCtx: Context\n  private readonly packageAllowlist: readonly RegExp[]\n  private readonly packageBlocklist: readonly RegExp[]\n  private readonly registrations = new Set<string>()\n","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/runtime-diagnostics/invariants/src/index.ts#L70-L106","documentation":"Error \"invariants: ${field} contains invalid regex ${JSON.stringify(value)}\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/runtime-diagnostics/invariants/src/index.ts:88 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the regex so it compiles."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b150a551b8d465e31e418e1b2eaf5e79bbb7d28e","analyzedAt":"2026-08-24T18:12:29.105Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}