{"record":{"id":"c19871fcf5fdf8dd","repo":"ruvnet/ruflo","slug":"token-stdin-no-input-received-on-stdin","errorCode":null,"errorMessage":"--token-stdin: no input received on stdin","messagePattern":"--token-stdin: no input received on stdin","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/cli/src/auth/client.ts","lineNumber":181,"sourceCode":"    rl.close();\n  }\n  if (!code) throw new LoginCancelledError();\n\n  const tokens = await sec.exchangeManualCode(code, pkce.codeVerifier);\n  return { tokens, method: 'device' };\n}\n\n/**\n * `--token-stdin`: reads one JSON object from stdin,\n * `{access_token, refresh_token?, expires_in, scope}`. Wire format is not\n * specified by ADR-306 — defined here as typed JSON rather than a bare\n * token string, so scope/expiry are explicit rather than inferred.\n */\nexport async function tokenStdinLogin(input: NodeJS.ReadableStream = process.stdin): Promise<LoginResult> {\n  const chunks: Buffer[] = [];\n  for await (const chunk of input) chunks.push(chunk as Buffer);\n  const raw = Buffer.concat(chunks).toString('utf-8').trim();\n  if (!raw) throw new Error('--token-stdin: no input received on stdin');\n\n  let parsed: { access_token?: string; refresh_token?: string; expires_in?: number; scope?: string };\n  try {\n    parsed = JSON.parse(raw);\n  } catch {\n    throw new Error(\n      '--token-stdin expects a single JSON object: {\"access_token\",\"refresh_token\"?,\"expires_in\",\"scope\"}',\n    );\n  }\n  if (!parsed.access_token) throw new Error('--token-stdin: JSON is missing required field \"access_token\"');\n\n  const tokens: OAuthTokenResponse = {\n    access_token: parsed.access_token,\n    token_type: 'Bearer',\n    refresh_token: parsed.refresh_token,\n    expires_in: parsed.expires_in,\n  };\n  return { tokens, method: 'token-stdin' };","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/ruvnet/ruflo/blob/6b01dc5a687b26b3e218f796de45ec51f8fa9e8c/v3/@claude-flow/cli/src/auth/client.ts#L163-L199","documentation":"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.","triggerScenarios":"Running `ruflo auth login --token-stdin` with no piped input, or piping an empty string.","commonSituations":"Forgot to pipe/redirect input; upstream token-producer emitted nothing; CI step ran before the token was available.","solutions":["Pipe a JSON token object: echo '{\"access_token\":\"...\"}' | ruflo auth login --token-stdin.","Ensure the upstream token-producer actually emits output before the CLI reads stdin."],"exampleFix":"# before\nruflo auth login --token-stdin   # nothing on stdin\n\n# after\nproducer-of-token-json | ruflo auth login --token-stdin","handlingStrategy":"validation","validationCode":"const raw = Buffer.concat(chunks).toString('utf-8').trim();\nif (!raw) {\n  throw new Error('--token-stdin: pipe a JSON token object on stdin');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["In CI, assert the token-producer exit code and non-empty stdout before piping.","Use --token-stdin only when input is guaranteed.","Document the exact JSON shape at the CLI help text."],"tags":["oauth","token-stdin","auth","cli"],"backgroundTag":null,"analyzedSha":"6b01dc5a687b26b3e218f796de45ec51f8fa9e8c","analyzedAt":"2026-08-12T13:20:50.148Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}