{"record":{"id":"d7719b727cd0eae5","repo":"coleam00/Archon","slug":"invalid-run-config-at-document-expected-an-obje","errorCode":null,"errorMessage":"Invalid run config at 'document': expected an object","messagePattern":"Invalid run config at 'document': expected an object","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/src/config/run-config.ts","lineNumber":175,"sourceCode":"      alias,\n      normalizePreset(`aliases.${alias}`, preset),\n    ])\n  );\n  return {\n    ...layer,\n    ...(layer.assistants === undefined ? {} : { assistants }),\n    ...(layer.tiers === undefined ? {} : { tiers }),\n    ...(layer.aliases === undefined ? {} : { aliases }),\n  };\n}\n\n/** Parse one explicitly selected sparse run config. Unlike shared config loading, this is fail-fast. */\nexport function parseWorkflowRunConfig(\n  value: unknown,\n  source: WorkflowRunConfigSource\n): WorkflowRunConfigInput {\n  if (!isRecord(value)) {\n    throw new Error(\"Invalid run config at 'document': expected an object\");\n  }\n\n  for (const key of Object.keys(value)) {\n    const classification = keyClassifications[key as ConfigKey] as KeyClassification | undefined;\n    if (!classification) {\n      throw new Error(`Unknown run config key '${key}'.`);\n    }\n    if (classification.kind === 'unavailable') {\n      throw new Error(`Run config key '${key}' cannot apply: ${classification.reason}.`);\n    }\n  }\n\n  if (value.assistant !== undefined && value.defaultAssistant !== undefined) {\n    throw new Error(\n      \"Run config cannot set both 'assistant' and 'defaultAssistant'; use one spelling.\"\n    );\n  }\n","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/core/src/config/run-config.ts#L157-L193","documentation":"parseWorkflowRunConfig() expects the top-level run config document to be an object (record). Any other type — string, array, number, null — is rejected with this fail-fast error before any keys are inspected.","triggerScenarios":"Passing a non-object (e.g. a YAML file that parses to a bare string or list, null, or an array) into parseWorkflowRunConfig(), e.g. via input() or loadWorkflowRunConfigFile().","commonSituations":"A run config YAML file containing only a scalar or a list; passing a JSON string instead of a parsed object; an empty file that parses to null.","solutions":["Wrap the config in a top-level mapping (key: value pairs)","Check what the YAML file actually parses to; quote values that might collapse to scalars","Ensure callers pass a parsed object, not raw text"],"exampleFix":"// before (config.yaml)\njust a string\n// after\nassistant: claude\ndocs:\n  path: ./docs","handlingStrategy":"type-guard","validationCode":"function assertRunConfigDocument(value) { if (typeof value !== 'object' || value === null || Array.isArray(value)) throw new Error('Run config must be a top-level object'); }","typeGuard":"function isRunConfigDocument(v) { return typeof v === 'object' && v !== null && !Array.isArray(v); }","tryCatchPattern":"try { cfg = parseWorkflowRunConfig(doc, source); } catch (e) { if (String(e.message).includes(\"at 'document'\")) console.error('Run config file must contain a YAML mapping, not a scalar/list'); throw e; }","preventionTips":["Start run config YAML files with a mapping key, never a bare scalar","Check parsed YAML shape before handing it to the loader","Avoid empty run config files (they parse to null)"],"tags":["config","validation","yaml"],"backgroundTag":"schema-validation-failed","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}