nanocoai/nanoclaw · error · StdinJsonInputError

--stdin-json input is empty

Error message

--stdin-json input is empty

What it means

composeSessionSpec refuses to build a spec whose group folder name is not a legal Kubernetes/Docker label value (<=63 bytes of [A-Za-z0-9._-], alphanumeric at both ends), because admission joins on the group-folder label verbatim and never projects it. Failing here, non-retryably, prevents an admission-side check from mis-comparing against a truncated hash stand-in and denying every session of the group.

Source

Thrown at container/agent-runner/src/cli/stdin-json.ts:65

  const chunks: Buffer[] = [];
  let byteLength = 0;

  for await (const chunk of stream) {
    const buffer = typeof chunk === 'string' ? Buffer.from(chunk, 'utf8') : Buffer.from(chunk);
    byteLength += buffer.byteLength;
    if (byteLength > MAX_STDIN_JSON_BYTES) {
      throw new StdinJsonInputError(`--stdin-json input exceeds ${MAX_STDIN_JSON_BYTES} bytes`);
    }
    chunks.push(buffer);
  }

  return Buffer.concat(chunks, byteLength).toString('utf8');
}

/** Parse the input, requiring exactly one JSON object — not an array, scalar, or null. */
function parseJsonObject(source: string): Record<string, unknown> {
  if (source.trim().length === 0) {
    throw new StdinJsonInputError('--stdin-json input is empty');
  }

  let parsed: unknown;
  try {
    parsed = JSON.parse(source);
  } catch (err) {
    throw new StdinJsonInputError('--stdin-json input is not valid JSON', { cause: err });
  }

  if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {
    throw new StdinJsonInputError('--stdin-json input must be one JSON object');
  }

  return parsed as Record<string, unknown>;
}

/** Match the key normalization applied by command parsers in crud.ts. */
function canonicalArgKey(key: string): string {

View on GitHub (pinned to 294ef2aee8)

Solutions

  1. Rename the group folder to match [a-z0-9._-] with alphanumeric ends and <=63 bytes
  2. Run `bun scripts/detect-driver-migration.ts` to enumerate affected groups and apply the suggested fix
  3. Update the agent_groups row's folder field to the renamed folder

Example fix

// before
agentGroup.folder = 'My Agent Group';
const spec = composeSessionSpec({ agentGroup, ... });

// after
agentGroup.folder = 'my-agent-group';
const spec = composeSessionSpec({ agentGroup, ... });
Defensive patterns

Strategy: validation

Validate before calling

const LABEL_RE = /^[A-Za-z0-9]([A-Za-z0-9._-]{0,61}[A-Za-z0-9])?$/;
if (!LABEL_RE.test(agentGroup.folder) || agentGroup.folder.length > 63) {
  throw new Error(`group folder '${agentGroup.folder}' is not a legal label value; rename it`);
}
const spec = composeSessionSpec({ agentGroup, ... });

Type guard

function isLegalLabelValue(v: string): boolean {
  return /^[A-Za-z0-9]([A-Za-z0-9._-]{0,61}[A-Za-z0-9])?$/.test(v) && v.length <= 63;
}

Prevention

When it happens

Trigger: composeSessionSpec() called with agentGroup.folder containing uppercase, spaces, slashes, leading/trailing dots or hyphens, or exceeding 63 bytes.

Common situations: A group folder created with a human-friendly name like 'My Agent Group' or 'agent/group'; folders inherited from older installs that predate the label constraint.

Related errors


AI-assisted analysis of nanocoai/nanoclaw@294ef2aee8 (2026-08-28). Data as JSON: /api/errors/78cff5c5ef920897. Report an issue: GitHub.