{"record":{"id":"e264317cce7ab65a","repo":"earendil-works/pi","slug":"min-expiry-must-use-a-duration-such-as-30m-or-1h","errorCode":null,"errorMessage":"--min-expiry must use a duration such as 30m or 1h","messagePattern":"--min-expiry must use a duration such as 30m or 1h","errorType":"validation","errorClass":"AuthCommandError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/cli/auth-command.ts","lineNumber":77,"sourceCode":"\tif (!kind) {\n\t\tthrow new AuthCommandError(\n\t\t\t`Unknown auth command \"${args[1] ?? \"\"}\". Use \"${APP_NAME} auth print-api-key\", \"${APP_NAME} auth print-bearer-token\", or \"${APP_NAME} auth check\".`,\n\t\t);\n\t}\n\n\tconst commandArgs: string[] = [];\n\tlet json = false;\n\tlet credentials = false;\n\tlet noRefresh = false;\n\tlet minExpiryMs: number | undefined;\n\tfor (let index = 2; index < args.length; index++) {\n\t\tconst arg = args[index];\n\t\tif (arg === \"--min-expiry\") {\n\t\t\tif (kind !== \"bearer_token\")\n\t\t\t\tthrow new AuthCommandError(\"--min-expiry is only supported by print-bearer-token\");\n\t\t\tconst value = args[++index];\n\t\t\tconst match = value ? /^(\\d+)(ms|s|m|h)$/iu.exec(value) : undefined;\n\t\t\tif (!match) throw new AuthCommandError(\"--min-expiry must use a duration such as 30m or 1h\");\n\t\t\tconst amount = Number(match[1]);\n\t\t\tconst unit = match[2];\n\t\t\tminExpiryMs = amount * (unit === \"ms\" ? 1 : unit === \"s\" ? 1_000 : unit === \"m\" ? 60_000 : 3_600_000);\n\t\t\tcontinue;\n\t\t}\n\t\tif (arg === \"--json\" || arg === \"--credentials\" || arg === \"--no-refresh\") {\n\t\t\tif (kind !== \"check\") throw new AuthCommandError(`${arg} is only supported by auth check`);\n\t\t\tif (arg === \"--json\") json = true;\n\t\t\telse if (arg === \"--credentials\") credentials = true;\n\t\t\telse noRefresh = true;\n\t\t\tcontinue;\n\t\t}\n\t\tcommandArgs.push(arg);\n\t}\n\n\treturn minExpiryMs === undefined\n\t\t? { kind, args: commandArgs, json, credentials, noRefresh }\n\t\t: { kind, args: commandArgs, json, credentials, noRefresh, minExpiryMs };","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/coding-agent/src/cli/auth-command.ts#L59-L95","documentation":"Error \"--min-expiry must use a duration such as 30m or 1h\" thrown in earendil-works/pi.","triggerScenarios":"Thrown at packages/coding-agent/src/cli/auth-command.ts:77 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4af9d21d3b4d664e4a29fcabfec85171077248e3","analyzedAt":"2026-08-24T13:07:14.692Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}