Fission-AI/OpenSpec · error

Invalid 'operations' field in config (must be object)

Error message

Invalid 'operations' field in config (must be object)

What it means

Resilience warning from parseOperations in project-config parsing: the top-level 'operations' field is present but not a plain object (null, array, scalar). Parsing of operations is abandoned and the rest of the config is still applied.

Solutions

  1. Fix 'operations' in openspec/config.yaml to be a mapping of operation id to object
  2. Indent operation entries under 'operations:' without list syntax
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at src/core/project-config.ts:126 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Fission-AI/OpenSpec@6926ccb18a (2026-08-25). Data as JSON: /api/errors/a862082c541c2a1b. Report an issue: GitHub.

Appendix: source

Thrown at src/core/project-config.ts:126

  const context =
    projectConfig?.context !== undefined && projectConfig.context.trim().length > 0
      ? projectConfig.context
      : undefined;
  const guidance = projectConfig?.operations?.[operationId]?.guidance;
  const operationGuidance = guidance && guidance.length > 0 ? guidance : undefined;

  return {
    ...(context !== undefined ? { context } : {}),
    ...(operationGuidance !== undefined ? { operationGuidance } : {}),
  };
}

function parseOperations(raw: unknown): OperationsConfig | undefined {
  if (raw === undefined) {
    return undefined;
  }
  if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {
    console.warn(`Invalid 'operations' field in config (must be object)`);
    return undefined;
  }

  const supported = new Set<string>(OPERATION_IDS);
  const operations: OperationsConfig = {};

  for (const [operationId, value] of Object.entries(raw)) {
    if (!supported.has(operationId)) {
      console.warn(
        `Unknown operation ID '${operationId}' in config. Supported operation IDs: ${OPERATION_IDS.join(', ')}`
      );
      continue;
    }

    const typedOperationId = operationId as OperationId;
    if (!value || typeof value !== 'object' || Array.isArray(value)) {
      console.warn(
        `Invalid 'operations.${operationId}' field in config (must be object), ignoring this operation`

View on GitHub (pinned to 6926ccb18a)