stablyai/orca · error · Error

--json-output requires a path

Error message

--json-output requires a path

What it means

Thrown by readRequiredValue when --json-output is followed by a null or flag-like token. --json-output writes the structured comparison object and, when present, must take a value (compare-benchmark-artifacts.mjs:36-38, 64-69).

Source

Thrown at config/scripts/compare-benchmark-artifacts.mjs:67

      }
      continue
    }
    throw new Error(USAGE)
  }

  if (!parsed.baselinePath) {
    throw new Error(USAGE)
  }
  if (!parsed.candidatePath) {
    throw new Error(USAGE)
  }
  return parsed
}

function readRequiredValue(args, index, message) {
  const value = args[index]
  if (value == null || value.startsWith('--')) {
    throw new Error(message)
  }
  return value
}

export function readBenchmarkArtifact(path) {
  return JSON.parse(readFileSync(path, 'utf8'))
}

export function normalizeBenchmarkArtifact(path, artifact = readBenchmarkArtifact(path)) {
  if (artifact?.summaryMedianMs != null) {
    return normalizeNumericObject(path, artifact, 'startup', artifact.summaryMedianMs, () => 'ms')
  }
  if (artifact?.summaryMedian != null) {
    return normalizeNumericObject(path, artifact, 'daemon', artifact.summaryMedian, (key) =>
      key.endsWith('Count') || key.endsWith('After') ? 'count' : 'ms'
    )
  }
  if (artifact?.suites != null) {

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Provide a valid file path token after --json-output, or remove the flag to skip JSON output.
  2. Ensure the path's parent directory can be created (mkdirSync recursive is called on dirname).

Example fix

// before
parseBenchmarkComparisonArgs(['--baseline','b.json','--candidate','c.json','--json-output'])
// after
parseBenchmarkComparisonArgs(['--baseline','b.json','--candidate','c.json','--json-output','reports/cmp.json'])
Defensive patterns

Strategy: validation

Validate before calling

const i = argv.indexOf('--json-output')
if (i !== -1 && (i + 1 >= argv.length || argv[i + 1].startsWith('--'))) {
  throw new Error('--json-output needs a path')
}

Prevention

When it happens

Trigger: Passing '--json-output' as the last token; passing '--json-output --higher-is-better key'; an empty variable for the JSON path.

Common situations: A reporting pipeline that conditionally emits JSON but the path variable is unset on a branch; flag-ordering mistakes; partial edit of a template command.

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/d54435d1e11e0a6c. Report an issue: GitHub.