{"record":{"id":"5e3a04368106a331","repo":"jackwener/OpenCLI","slug":"only-must-be-one-of-all-logged-in-not-logged","errorCode":null,"errorMessage":"--only must be one of: all, logged-in, not-logged-in, unknown, error","messagePattern":"--only must be one of: all, logged-in, not-logged-in, unknown, error","errorType":"validation","errorClass":"InvalidArgumentError","httpStatus":null,"severity":"error","filePath":"src/commands/auth.ts","lineNumber":420,"sourceCode":"  let next = 0;\n  const runners = Array.from({ length: Math.min(concurrency, items.length) }, async () => {\n    while (next < items.length) {\n      const index = next++;\n      results[index] = await worker(items[index]);\n    }\n  });\n  await Promise.all(runners);\n  return results;\n}\n\nexport async function collectAuthStatus(options: AuthStatusOptions): Promise<AuthStatusRow[]> {\n  const selectedSites = parseSiteFilter(options.sites);\n  const mode: AuthStatusMode = options.full ? 'full' : 'quick';\n  const concurrency = parsePositiveInt(options.concurrency, '--concurrency', mode === 'full' ? 3 : 8);\n  const timeoutSeconds = parsePositiveInt(options.timeout, '--timeout', mode === 'full' ? 20 : 8);\n  const only = String(options.only ?? 'all');\n  if (!['all', 'logged-in', 'not-logged-in', 'unknown', 'error'].includes(only)) {\n    throw new InvalidArgumentError('--only must be one of: all, logged-in, not-logged-in, unknown, error');\n  }\n\n  const commands = authWhoamiCommands().filter(cmd => !selectedSites || selectedSites.has(cmd.site));\n  const rows = await mapConcurrent(commands, concurrency, cmd => (\n    mode === 'full'\n      ? runFull(cmd, { timeoutSeconds, profile: options.profile })\n      : runQuick(cmd, { timeoutSeconds, profile: options.profile })\n  ));\n\n  const normalizedOnly = only.replace(/-/g, '_');\n  return normalizedOnly === 'all'\n    ? rows\n    : rows.filter(row => row.status === normalizedOnly);\n}\n\nexport async function collectAuthRefresh(options: AuthRefreshOptions): Promise<AuthRefreshRow[]> {\n  const selectedSites = parseSiteFilter(options.sites);\n  const concurrency = parsePositiveInt(options.concurrency, '--concurrency', 3);","sourceCodeStart":402,"sourceCodeEnd":438,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/src/commands/auth.ts#L402-L438","documentation":"collectAuthStatus validates the --only option of the auth status command against a fixed whitelist: all, logged-in, not-logged-in, unknown, error. Any other value raises this commander InvalidArgumentError before any sites are checked.","triggerScenarios":"opencli auth status --only loggedIn, --only \"logged in\", --only LOGIN, --only failed — i.e. any casing/spelling/synonym that is not exactly one of the five allowed strings.","commonSituations":"Guessing flag values without checking --help; using hyphenated variants like logged_in or notloggedin; shell scripts passing user input straight through to --only.","solutions":["Use one of the exact values: all, logged-in, not-logged-in, unknown, error.","Run opencli auth status --help to see accepted values.","Normalize/whitelist the value in scripts before forwarding it to --only."],"exampleFix":"// before\nopencli auth status --only loggedIn\n// after\nopencli auth status --only logged-in","handlingStrategy":"validation","validationCode":"const ONLY_VALUES = ['all', 'logged-in', 'not-logged-in', 'unknown', 'error'] as const;\nif (opts.only !== undefined && !ONLY_VALUES.includes(opts.only as any)) {\n  throw new Error(`--only must be one of: ${ONLY_VALUES.join(', ')}`);\n}","typeGuard":"type AuthOnly = 'all' | 'logged-in' | 'not-logged-in' | 'unknown' | 'error';\nconst isAuthOnly = (v: unknown): v is AuthOnly =>\n  ['all', 'logged-in', 'not-logged-in', 'unknown', 'error'].includes(v as AuthOnly);","tryCatchPattern":"try {\n  await opencli.authStatus({ only: opts.only });\n} catch (e) {\n  if (/--only must be one of/.test(e.message)) {\n    console.error('Allowed values: all, logged-in, not-logged-in, unknown, error');\n  } else throw e;\n}","preventionTips":["Copy allowed values from --help rather than guessing.","Use kebab-case exactly: logged-in, not-logged-in.","Whitelist user/script input before forwarding to --only."],"tags":["cli","argument-validation","enum"],"backgroundTag":"invalid-argument-value","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}