jackwener/OpenCLI · error · ArgumentError

manifestPath row ${index + 1} is missing a valid Grok conver

Error message

manifestPath row ${index + 1} is missing a valid Grok conversation id

What it means

normalizeManifestRows requires each manifest row's id to match GROK_CONVERSATION_ID_RE (a lowercase/uppercase-agnostic UUID v4-shaped pattern). This ArgumentError is thrown when row N's id is missing, empty, or not a valid Grok conversation UUID. A valid id is mandatory because it keys the conversation and anchors its URL.

Source

Thrown at clis/grok/export-utils.js:85

            id,
            title: row.title == null || row.title === '' ? '' : String(row.title),
            date: row.date == null || row.date === '' ? '' : String(row.date),
            url: normalizeGrokUrl(row.url, id, (reason) => new CommandExecutionError(`${label} returned a malformed row`, reason)),
        };
    });
}

export function normalizeManifestRows(rows) {
    if (!Array.isArray(rows)) {
        throw new ArgumentError('manifestPath', 'must point to a JSON array exported by grok/export');
    }
    return rows.map((row, index) => {
        if (!row || typeof row !== 'object' || Array.isArray(row)) {
            throw new ArgumentError('manifestPath', `row ${index + 1} must be an object`);
        }
        const id = String(row.id || '').trim().toLowerCase();
        if (!GROK_CONVERSATION_ID_RE.test(id)) {
            throw new ArgumentError('manifestPath', `row ${index + 1} is missing a valid Grok conversation id`);
        }
        return {
            id,
            title: row.title == null || row.title === '' ? '' : String(row.title),
            date: row.date == null || row.date === '' ? '' : String(row.date),
            url: normalizeGrokUrl(row.url, id, (reason) => new ArgumentError('manifestPath', `row ${index + 1}: ${reason}`)),
        };
    });
}

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Locate element N-1 (index in the message is 1-based) and fix its `id` to the full Grok conversation UUID.
  2. Regenerate the manifest with `grok/export` so ids come straight from Grok.
  3. Validate offline with the exported pattern: /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/i.test(row.id).
  4. If converting from another export format, map the external conversation key to the Grok UUID before normalization.

Example fix

// before
const rows = [{ id: 'conv-123', title: 'x' }];
normalizeManifestRows(rows);

// after
const rows = [{ id: 'd4c3b2a1-0987-4abc-8def-112233445566', title: 'x' }];
normalizeManifestRows(rows);
Defensive patterns

Strategy: validation

Validate before calling

const GROK_ID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
const badIdx = parsed.findIndex((r) => r && typeof r === 'object' && !GROK_ID_RE.test(String(r.id ?? '').trim()));
if (badIdx !== -1) throw new Error(`manifest row ${badIdx + 1} has invalid Grok conversation id`);

Type guard

function isGrokUuid(value) {
  return typeof value === 'string' &&
    /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value.trim());
}

Try / catch

try {
  const rows = normalizeManifestRows(parsed);
} catch (err) {
  if (err instanceof ArgumentError && /missing a valid Grok conversation id/.test(err.message)) {
    console.error(`Fix the id in your manifest — ${err.message}`);
  } else throw err;
}

Prevention

When it happens

Trigger: A --manifestPath array element N has no `id` field, id is "", id is a numeric or short slug (e.g. a title slug), or an otherwise non-UUID string; detail: `row ${index + 1} is missing a valid Grok conversation id`.

Common situations: Manifest produced by an older or third-party exporter with a different id format; ids were re-generated as numeric DB keys; a schema migration dropped the id column; rows hand-written without ids for 'to be filled in later' placeholders.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/ff7f0948600001a3. Report an issue: GitHub.