Fission-AI/OpenSpec · error

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

Error message

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

What it means

Warning from readProjectConfig: the top-level 'rules' field is not an object, so no rules can be parsed from config.yaml. The rest of the config (schema, context, etc.) still applies; the whole rules section is ignored and the field name is reported for correction.

Solutions

  1. Structure 'rules' as a mapping of artifact id to string list
  2. Check for list or scalar syntax at the top of the rules block
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at src/core/project-config.ts:352 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/8e4c32143f512a98. Report an issue: GitHub.

Appendix: source

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

              hasValidRules = true;
            }
            if (validRules.length < rulesArrayResult.data.length) {
              console.warn(
                `Some rules for '${artifactId}' are empty strings, ignoring them`
              );
            }
          } else {
            console.warn(
              `Rules for '${artifactId}' must be an array of strings, ignoring this artifact's rules`
            );
          }
        }

        if (hasValidRules) {
          config.rules = parsedRules;
        }
      } else {
        console.warn(`Invalid 'rules' field in config (must be object)`);
      }
    }

    const operations = parseOperations(raw.operations);
    if (operations) {
      config.operations = operations;
    }

    const references = parseDeclarationList(raw.references);
    if (references) {
      config.references = references;
    }

    // Parse store pointer field: a string, or dropped with a warning.
    // (Root resolution does NOT use this parse — it uses readStorePointer
    // below, which errors on malformed pointers instead of dropping.)
    if (raw.store !== undefined) {
      if (typeof raw.store === 'string') {

View on GitHub (pinned to 6926ccb18a)