ruvnet/ruflo · error · Error

--token-stdin: no input received on stdin

Error message

--token-stdin: no input received on stdin

What it means

Thrown by tokenStdinLogin when stdin contained no bytes (or only whitespace). The CLI cannot construct a token from nothing; --token-stdin requires a JSON token object on stdin.

Source

Thrown at v3/@claude-flow/cli/src/auth/client.ts:181

    rl.close();
  }
  if (!code) throw new LoginCancelledError();

  const tokens = await sec.exchangeManualCode(code, pkce.codeVerifier);
  return { tokens, method: 'device' };
}

/**
 * `--token-stdin`: reads one JSON object from stdin,
 * `{access_token, refresh_token?, expires_in, scope}`. Wire format is not
 * specified by ADR-306 — defined here as typed JSON rather than a bare
 * token string, so scope/expiry are explicit rather than inferred.
 */
export async function tokenStdinLogin(input: NodeJS.ReadableStream = process.stdin): Promise<LoginResult> {
  const chunks: Buffer[] = [];
  for await (const chunk of input) chunks.push(chunk as Buffer);
  const raw = Buffer.concat(chunks).toString('utf-8').trim();
  if (!raw) throw new Error('--token-stdin: no input received on stdin');

  let parsed: { access_token?: string; refresh_token?: string; expires_in?: number; scope?: string };
  try {
    parsed = JSON.parse(raw);
  } catch {
    throw new Error(
      '--token-stdin expects a single JSON object: {"access_token","refresh_token"?,"expires_in","scope"}',
    );
  }
  if (!parsed.access_token) throw new Error('--token-stdin: JSON is missing required field "access_token"');

  const tokens: OAuthTokenResponse = {
    access_token: parsed.access_token,
    token_type: 'Bearer',
    refresh_token: parsed.refresh_token,
    expires_in: parsed.expires_in,
  };
  return { tokens, method: 'token-stdin' };

View on GitHub (pinned to 6b01dc5a68)

Solutions

  1. Pipe a JSON token object: echo '{"access_token":"..."}' | ruflo auth login --token-stdin.
  2. Ensure the upstream token-producer actually emits output before the CLI reads stdin.

Example fix

# before
ruflo auth login --token-stdin   # nothing on stdin

# after
producer-of-token-json | ruflo auth login --token-stdin
Defensive patterns

Strategy: validation

Validate before calling

const raw = Buffer.concat(chunks).toString('utf-8').trim();
if (!raw) {
  throw new Error('--token-stdin: pipe a JSON token object on stdin');
}

Prevention

When it happens

Trigger: Running `ruflo auth login --token-stdin` with no piped input, or piping an empty string.

Common situations: Forgot to pipe/redirect input; upstream token-producer emitted nothing; CI step ran before the token was available.

Related errors


AI-assisted analysis of ruvnet/ruflo@6b01dc5a68 (2026-08-12). Data as JSON: /api/errors/c19871fcf5fdf8dd. Report an issue: GitHub.