affaan-m/ECC · error
ck save: invalid JSON on stdin — ${e.message}
Error message
ck save: invalid JSON on stdin — ${e.message} What it means
The ck save command reads a JSON document from stdin (fd 0); reading or parsing failed — including the explicit 'empty stdin' case — so there is no record to save. The parse error message is embedded.
Source
Thrown at skills/ck/commands/save.mjs:37
import { readFileSync, mkdirSync, writeFileSync } from 'fs';
import { resolve } from 'path';
import {
readProjects, writeProjects, loadContext, saveContext,
today, shortId, gitSummary, nativeMemoryDir,
CURRENT_SESSION,
} from './shared.mjs';
const isInit = process.argv.includes('--init');
const cwd = process.env.PWD || process.cwd();
// ── Read JSON from stdin ──────────────────────────────────────────────────────
let input;
try {
const raw = readFileSync(0, 'utf8').trim();
if (!raw) throw new Error('empty stdin');
input = JSON.parse(raw);
} catch (e) {
console.error(`ck save: invalid JSON on stdin — ${e.message}`);
console.log('Expected schema (save): {"summary":"...","leftOff":"...","nextSteps":["..."],"decisions":[{"what":"...","why":"..."}],"blockers":["..."]}');
console.log('Expected schema (--init): {"name":"...","path":"...","description":"...","stack":["..."],"goal":"...","constraints":["..."]}');
process.exit(1);
}
// ─────────────────────────────────────────────────────────────────────────────
// INIT MODE: first-time project registration
// ─────────────────────────────────────────────────────────────────────────────
if (isInit) {
const { name, path: projectPath, description, stack, goal, constraints, repo } = input;
if (!name || !projectPath) {
console.log('ck init: name and path are required.');
process.exit(1);
}
const projects = readProjects();
View on GitHub (pinned to 06c5e118c4)
Solutions
- Fix the JSON input/output so it parses; check the cited line/error detail.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Triggered when save.mjs rejects the current invocation: ck save: invalid JSON on stdin — <value>
Common situations: Occurs while running skills/ck/commands/save.mjs with invalid arguments, missing flags, or a failing external dependency; the guard at skills/ck/commands/save.mjs:37 aborts the command with this message.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of affaan-m/ECC@06c5e118c4 (2026-08-18).
Data as JSON: /api/errors/3a787a49c8a827d9.
Report an issue: GitHub.