{"record":{"id":"ff7f0948600001a3","repo":"jackwener/OpenCLI","slug":"manifestpath-row-index-1-is-missing-a-valid-g","errorCode":null,"errorMessage":"manifestPath row ${index + 1} is missing a valid Grok conversation id","messagePattern":"manifestPath row (.+?) is missing a valid Grok conversation id","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/grok/export-utils.js","lineNumber":85,"sourceCode":"            id,\n            title: row.title == null || row.title === '' ? '' : String(row.title),\n            date: row.date == null || row.date === '' ? '' : String(row.date),\n            url: normalizeGrokUrl(row.url, id, (reason) => new CommandExecutionError(`${label} returned a malformed row`, reason)),\n        };\n    });\n}\n\nexport function normalizeManifestRows(rows) {\n    if (!Array.isArray(rows)) {\n        throw new ArgumentError('manifestPath', 'must point to a JSON array exported by grok/export');\n    }\n    return rows.map((row, index) => {\n        if (!row || typeof row !== 'object' || Array.isArray(row)) {\n            throw new ArgumentError('manifestPath', `row ${index + 1} must be an object`);\n        }\n        const id = String(row.id || '').trim().toLowerCase();\n        if (!GROK_CONVERSATION_ID_RE.test(id)) {\n            throw new ArgumentError('manifestPath', `row ${index + 1} is missing a valid Grok conversation id`);\n        }\n        return {\n            id,\n            title: row.title == null || row.title === '' ? '' : String(row.title),\n            date: row.date == null || row.date === '' ? '' : String(row.date),\n            url: normalizeGrokUrl(row.url, id, (reason) => new ArgumentError('manifestPath', `row ${index + 1}: ${reason}`)),\n        };\n    });\n}\n","sourceCodeStart":67,"sourceCodeEnd":95,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/grok/export-utils.js#L67-L95","documentation":"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.","triggerScenarios":"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`.","commonSituations":"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.","solutions":["Locate element N-1 (index in the message is 1-based) and fix its `id` to the full Grok conversation UUID.","Regenerate the manifest with `grok/export` so ids come straight from Grok.","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).","If converting from another export format, map the external conversation key to the Grok UUID before normalization."],"exampleFix":"// before\nconst rows = [{ id: 'conv-123', title: 'x' }];\nnormalizeManifestRows(rows);\n\n// after\nconst rows = [{ id: 'd4c3b2a1-0987-4abc-8def-112233445566', title: 'x' }];\nnormalizeManifestRows(rows);","handlingStrategy":"validation","validationCode":"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;\nconst badIdx = parsed.findIndex((r) => r && typeof r === 'object' && !GROK_ID_RE.test(String(r.id ?? '').trim()));\nif (badIdx !== -1) throw new Error(`manifest row ${badIdx + 1} has invalid Grok conversation id`);","typeGuard":"function isGrokUuid(value) {\n  return typeof value === 'string' &&\n    /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value.trim());\n}","tryCatchPattern":"try {\n  const rows = normalizeManifestRows(parsed);\n} catch (err) {\n  if (err instanceof ArgumentError && /missing a valid Grok conversation id/.test(err.message)) {\n    console.error(`Fix the id in your manifest — ${err.message}`);\n  } else throw err;\n}","preventionTips":["Validate every manifest id against GROK_CONVERSATION_ID_RE before processing.","Map external/legacy id formats to Grok UUIDs at ingestion time.","Regenerate manifests via grok/export after any schema migration."],"tags":["validation","uuid","manifest","grok-export"],"backgroundTag":"schema-validation-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}