deepseek-ai/deepseek-harness · error

invariants: ${field} entries must be non-blank and have no s

Error message

invariants: ${field} entries must be non-blank and have no surrounding whitespace

What it means

Error "invariants: ${field} entries must be non-blank and have no surrounding whitespace" thrown in deepseek-ai/deepseek-harness.

Source

Thrown at packages/runtime-diagnostics/invariants/src/index.ts:79

  constructor(packageName: string, message: string) {
    super(`invariant violated by "${packageName}": ${message}`)
    this.name = 'InvariantError'
    this.packageName = packageName
  }
}

declare module '@deepseek-ai/cordis' {
  interface Context {
    invariants: InvariantRegistry
  }
}

/** Compile and validate one package-filter list. */
function compilePatterns(field: 'package_allowlist' | 'package_blocklist', values: readonly string[]): RegExp[] {
  const seen = new Set<string>()
  return values.map((value) => {
    if (value.length === 0 || value.trim() !== value) {
      throw new Error(`invariants: ${field} entries must be non-blank and have no surrounding whitespace`)
    }
    if (seen.has(value)) {
      throw new Error(`invariants: ${field} contains duplicate regex ${JSON.stringify(value)}`)
    }
    seen.add(value)
    try {
      return new RegExp(value)
    } catch (cause) {
      throw new Error(`invariants: ${field} contains invalid regex ${JSON.stringify(value)}`, { cause })
    }
  })
}

/** Package-owned invariant registry with global and regex-based selection. */
export class InvariantRegistry extends Service {
  static Config: Schema<Config> = z.object({
    enabled: z.boolean().default(true),
    package_allowlist: z.array(z.string()).default([]),

View on GitHub (pinned to b150a551b8)

Solutions

  1. Make every entry non-blank with no surrounding whitespace.

When it happens

Trigger: Thrown at packages/runtime-diagnostics/invariants/src/index.ts:79 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of deepseek-ai/deepseek-harness@b150a551b8 (2026-08-24). Data as JSON: /api/errors/147fb9c860d044e2. Report an issue: GitHub.