{"record":{"id":"ac190b896f227d89","repo":"coleam00/Archon","slug":"expected-expected","errorCode":null,"errorMessage":"expected ${expected}","messagePattern":"expected (.+?)","errorType":"validation","errorClass":"InvalidProviderRunConfigError","httpStatus":null,"severity":"error","filePath":"packages/providers/src/shared/run-config.ts","lineNumber":14,"sourceCode":"import { InvalidProviderRunConfigError } from '../errors';\n\nexport function assertKnownRunConfigKeys(\n  raw: Record<string, unknown>,\n  allowed: readonly string[]\n): void {\n  const unknown = Object.keys(raw).find(key => !allowed.includes(key));\n  if (unknown !== undefined) {\n    throw new InvalidProviderRunConfigError(unknown, 'unknown provider setting');\n  }\n}\n\nexport function invalidRunConfigValue(fieldPath: string, expected: string): never {\n  throw new InvalidProviderRunConfigError(fieldPath, `expected ${expected}`);\n}\n\nexport function normalizeRunConfigString(value: unknown, fieldPath: string): string | undefined {\n  if (value === undefined) return undefined;\n  if (typeof value !== 'string' || value.trim().length === 0) {\n    invalidRunConfigValue(fieldPath, 'a non-blank string');\n  }\n  return value.trim();\n}\n\nexport function isConfigRecord(value: unknown): value is Record<string, unknown> {\n  return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\n","sourceCodeStart":1,"sourceCodeEnd":28,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/providers/src/shared/run-config.ts#L1-L28","documentation":"invalidRunConfigValue is the shared helper provider parsers use to throw InvalidProviderRunConfigError for a field that exists but has the wrong shape or value; the message is always 'expected <requirement>' (e.g. 'a non-blank string'). It is the value-level counterpart to assertKnownRunConfigKeys, which handles unknown keys.","triggerScenarios":"Any parseXxxRunConfig call where a known key holds an invalid value: a blank/non-string model, wrong type for a flag, malformed enum value — each parser calls invalidRunConfigValue(fieldPath, expected) with the specific expectation.","commonSituations":"YAML/JSON quoting mistakes turning numbers into strings or vice versa; empty-string settings from env interpolation; passing boolean flags as strings; supplying an out-of-range or unrecognized enum value.","solutions":["Read the 'expected ...' phrase in the error and fix the field's type/value to match","Trim or supply a non-blank string where blank values occur (e.g. from empty env vars)","Coerce or correct types at the config source (quote/unquote in YAML, use proper JSON types)","Check the provider parser's allowed values for enum-like fields"],"exampleFix":"// before\nparseCodexRunConfig({ model: process.env.CODEX_MODEL ?? '' });\n// after\nconst model = process.env.CODEX_MODEL?.trim();\nif (!model) throw new Error('CODEX_MODEL must be set');\nparseCodexRunConfig({ model });","handlingStrategy":"validation","validationCode":"function assertNonBlankString(v: unknown, field: string): asserts v is string {\n  if (typeof v !== 'string' || v.trim().length === 0) {\n    throw new Error(`${field} must be a non-blank string`);\n  }\n}","typeGuard":"function isNonBlankString(v: unknown): v is string {\n  return typeof v === 'string' && v.trim().length > 0;\n}","tryCatchPattern":"import { InvalidProviderRunConfigError } from '@archon/providers';\ntry {\n  cfg = parseRunConfig(raw);\n} catch (err) {\n  if (err instanceof InvalidProviderRunConfigError) {\n    console.error(`Field '${err.fieldPath}': ${err.message} — fix the value's type/shape`);\n  }\n  throw err;\n}","preventionTips":["Fix YAML/JSON quoting so values keep their intended types","Expand env-var defaults before parsing; treat empty strings as missing","Validate config shape (zod or similar) before handing it to provider parsers"],"tags":["run-config","validation","type-mismatch","configuration"],"backgroundTag":"config-value-validation-failed","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}