stablyai/orca · error

Artifact create recovery record has an unsupported format.

Error message

Artifact create recovery record has an unsupported format.

What it means

Thrown by readIntent() when the parsed JSON is falsy or not a plain object — e.g. parsed to null, a number, a string, or an array. Before any schema field is checked, the top-level shape must be an object. This is the coarsest format guard; finer field validation happens at 748.

Source

Thrown at src/main/artifacts/artifact-create-intent-store.ts:155

function readIntent(path: string): ArtifactCreateIntent {
  let size: number
  try {
    size = statSync(path).size
  } catch (error) {
    throw new Error('Artifact create recovery record could not be read safely.', { cause: error })
  }
  if (size > MAX_ARTIFACT_CREATE_INTENT_BYTES) {
    throw new Error('Artifact create recovery record exceeds the supported size.')
  }
  let parsed: unknown
  try {
    parsed = JSON.parse(readFileSync(path, 'utf8'))
  } catch (error) {
    throw new Error('Artifact create recovery record could not be read safely.', { cause: error })
  }
  if (!parsed || typeof parsed !== 'object') {
    throw new Error('Artifact create recovery record has an unsupported format.')
  }
  const intent = parsed as Partial<ArtifactCreateIntent>
  if (
    intent.version !== 1 ||
    typeof intent.sourceKey !== 'string' ||
    typeof intent.idempotencyKey !== 'string' ||
    !intent.idempotencyKey ||
    !isScope(intent.scope) ||
    !isWriteBody(intent.body)
  ) {
    throw new Error('Artifact create recovery record has an unsupported format.')
  }
  return intent as ArtifactCreateIntent
}

export function getArtifactCreateIntent(
  profileId: string,
  userDataPath: string,

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Inspect the raw file content to confirm what non-object payload is present.
  2. Delete/quarantine the malformed intent and re-create the share.
  3. Add a migration/version check if a format change produced non-object payloads across versions.

Example fix

// before
// intent file contains: null
const intent = readIntent(path) // throws

// after
// delete the bad file and re-share to regenerate a well-formed intent
Defensive patterns

Strategy: validation

Validate before calling

import { readFileSync } from 'node:fs'

function isIntentTopLevelObject(path: string): boolean {
  let parsed: unknown
  try { parsed = JSON.parse(readFileSync(path, 'utf8')) } catch { return false }
  return Boolean(parsed) && typeof parsed === 'object' && !Array.isArray(parsed)
}

if (!isIntentTopLevelObject(path)) {
  await quarantineIntentFile(path)
  return null
}

Type guard

function isPlainObject(v: unknown): v is Record<string, unknown> {
  return typeof v === 'object' && v !== null && !Array.isArray(v)
}

Try / catch

try {
  return readIntent(path)
} catch (e) {
  if ((e as Error).message === 'Artifact create recovery record has an unsupported format.') {
    await quarantineIntentFile(path)
    return null
  }
  throw e
}

Prevention

When it happens

Trigger: The intent file contains `null`, a bare primitive, an array, or an empty document. Often the result of a hand-edit, a different file format written to the path, or a downgraded writer.

Common situations: A user/developer opened the .json and replaced contents with `null` or `[]`; an older/newer version wrote a non-object container; a telemetry or log file collided with the intent path.

Related errors


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