Hmbown/CodeWhale · error · Error

Codewhale session produced no inspectable events.

Error message

Codewhale session produced no inspectable events.

What it means

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.

Solutions

  1. Inspect a sample journal entry and confirm it has message.content blocks, message.text, or entry.text the converter recognizes.
  2. Check for a sourceFormat/producer version mismatch; re-export with the matching Codewhale version or update the importer.
  3. Verify activeJournalEntries isn't returning only placeholder/tombstone entries.
  4. If the session document is genuinely content-free, treat it like error 192 and skip it at the call site.

Example fix

// before
const trace = trace(doc);
// after
const hasPayload = (doc.journal?.entries ?? doc.messages ?? []).some(e => e?.message?.content || e?.message?.text || e?.text);
if (!hasPayload) { console.warn('session has entries but no convertible payloads'); return; }
const trace = trace(doc);
Defensive patterns

Strategy: validation

Validate before calling

const convertible = (doc.journal?.entries ?? []).some(e => e?.message?.content || e?.message?.text || e?.text)
  || (doc.messages ?? []).some(m => m?.content || m?.text);
if (!convertible) { skip(file); return; }

Type guard

const hasPayload = (e: any): boolean => e != null && (typeof e?.text === 'string' || typeof e?.message?.text === 'string' || Array.isArray(e?.message?.content));

Try / catch

try { trace = fromCodewhaleSession(doc, file); }
catch (e) { if (e.message.includes('no inspectable events')) { quarantine(file); return null; } throw e; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15). Data as JSON: /api/errors/add080e2a8117c20. Report an issue: GitHub.

Appendix: source

Thrown at pet/src/core/codewhale.ts:262

      } else {
        const text = str(block.text) ?? '';
        const operate = text.includes('codewhale:runtime_event');
        const user = role === 'user' || role === 'User';
        pushEvent(events, {
          schemaVersion: 1, id: idBase, traceId: sessionId, parentId: parentEventId,
          startTime: t.start, endTime: t.start, agentId,
          name: operate ? 'operate_contract' : user ? 'user_message' : 'assistant_message',
          category: operate ? 'orchestration' : user ? 'human' : 'communication',
          model, provider, status: 'success',
          attributes: { 'codewhale.entry_id': entryId, 'codewhale.seq': seq, role: role ?? 'unknown' },
          payload: { text: clip(text) }, raw,
        });
      }
      seq += 1;
    }
  }

  if (!events.length) throw new Error('Codewhale session produced no inspectable events.');
  for (const event of events) {
    if (event.openEnded && event.tool) warnings.push(`Tool ${event.id} has no matching tool_result in this snapshot; duration remains unknown.`);
  }
  const base = events.reduce((m, e) => Math.min(m, e.startTime), events[0]!.startTime);
  for (const event of events) { event.startTime -= base; event.endTime -= base; }
  const cost = obj(metadata.cost);
  const sessionCost = num(cost.session_cost_usd);
  const duration = Math.max(1, events.reduce((m, e) => Math.max(m, e.endTime, e.startTime), 0));
  const uniqueWarnings = [...new Set(warnings)];
  return {
    id: sessionId,
    name: titleOfSession(metadata, filename),
    events,
    duration,
    originTime: orderOnly ? 'journal-order' : (str(metadata.created_at) ?? `${base} ms`),
    source: 'codewhale',
    privacy: 'redact',
    warnings: uniqueWarnings,

View on GitHub (pinned to 433685b202)