{"record":{"id":"add080e2a8117c20","repo":"Hmbown/CodeWhale","slug":"codewhale-session-produced-no-inspectable-events-add080","errorCode":null,"errorMessage":"Codewhale session produced no inspectable events.","messagePattern":"Codewhale session produced no inspectable events\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"pet/src/core/codewhale.ts","lineNumber":262,"sourceCode":"      } else {\n        const text = str(block.text) ?? '';\n        const operate = text.includes('codewhale:runtime_event');\n        const user = role === 'user' || role === 'User';\n        pushEvent(events, {\n          schemaVersion: 1, id: idBase, traceId: sessionId, parentId: parentEventId,\n          startTime: t.start, endTime: t.start, agentId,\n          name: operate ? 'operate_contract' : user ? 'user_message' : 'assistant_message',\n          category: operate ? 'orchestration' : user ? 'human' : 'communication',\n          model, provider, status: 'success',\n          attributes: { 'codewhale.entry_id': entryId, 'codewhale.seq': seq, role: role ?? 'unknown' },\n          payload: { text: clip(text) }, raw,\n        });\n      }\n      seq += 1;\n    }\n  }\n\n  if (!events.length) throw new Error('Codewhale session produced no inspectable events.');\n  for (const event of events) {\n    if (event.openEnded && event.tool) warnings.push(`Tool ${event.id} has no matching tool_result in this snapshot; duration remains unknown.`);\n  }\n  const base = events.reduce((m, e) => Math.min(m, e.startTime), events[0]!.startTime);\n  for (const event of events) { event.startTime -= base; event.endTime -= base; }\n  const cost = obj(metadata.cost);\n  const sessionCost = num(cost.session_cost_usd);\n  const duration = Math.max(1, events.reduce((m, e) => Math.max(m, e.endTime, e.startTime), 0));\n  const uniqueWarnings = [...new Set(warnings)];\n  return {\n    id: sessionId,\n    name: titleOfSession(metadata, filename),\n    events,\n    duration,\n    originTime: orderOnly ? 'journal-order' : (str(metadata.created_at) ?? `${base} ms`),\n    source: 'codewhale',\n    privacy: 'redact',\n    warnings: uniqueWarnings,","sourceCodeStart":244,"sourceCodeEnd":280,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/pet/src/core/codewhale.ts#L244-L280","documentation":"After converting all source entries, fromCodewhaleSession() throws if the events array is still empty — meaning entries existed but none yielded an inspectable event. This differs from error 192: the document had journal entries/messages, but the conversion produced nothing usable, so a trace with zero events would be meaningless.","triggerScenarios":"A journal whose entries are all non-message kinds with no message/text/content payload (conversion drops them), entries containing only unrecognized block types, or activeJournalEntries returning entries that obj()/str() normalization reduces to empty.","commonSituations":"A session export from a newer Codewhale version whose entry shape the importer doesn't recognize yet, hand-edited or sanitized session JSON with content stripped, or importing a partial export where payloads were omitted.","solutions":["Inspect a sample journal entry and confirm it has message.content blocks, message.text, or entry.text the converter recognizes.","Check for a sourceFormat/producer version mismatch; re-export with the matching Codewhale version or update the importer.","Verify activeJournalEntries isn't returning only placeholder/tombstone entries.","If the session document is genuinely content-free, treat it like error 192 and skip it at the call site."],"exampleFix":"// before\nconst trace = trace(doc);\n// after\nconst hasPayload = (doc.journal?.entries ?? doc.messages ?? []).some(e => e?.message?.content || e?.message?.text || e?.text);\nif (!hasPayload) { console.warn('session has entries but no convertible payloads'); return; }\nconst trace = trace(doc);","handlingStrategy":"validation","validationCode":"const convertible = (doc.journal?.entries ?? []).some(e => e?.message?.content || e?.message?.text || e?.text)\n  || (doc.messages ?? []).some(m => m?.content || m?.text);\nif (!convertible) { skip(file); return; }","typeGuard":"const hasPayload = (e: any): boolean => e != null && (typeof e?.text === 'string' || typeof e?.message?.text === 'string' || Array.isArray(e?.message?.content));","tryCatchPattern":"try { trace = fromCodewhaleSession(doc, file); }\ncatch (e) { if (e.message.includes('no inspectable events')) { quarantine(file); return null; } throw e; }","preventionTips":["Verify export/import versions match when entry shapes change.","Sample-parse one journal entry in CI against the importer.","Never strip message payloads when sanitizing exports."],"tags":["import","empty-input","session","schema"],"backgroundTag":"empty-result-set","analyzedSha":"433685b2024e7bc4c99e1e2e326bcad39b4d9d65","analyzedAt":"2026-09-15T12:24:24.634Z","contentChangedAt":"2026-09-15T12:24:24.634Z","schemaVersion":2},"datasetVersion":"2026-09-22T11:17:16.035Z"}