{"record":{"id":"2ac9f057866475ae","repo":"jlcodes99/cockpit-tools","slug":"messages-rawlinenorefreshtoken-item-linenumber","errorCode":null,"errorMessage":"messages.rawLineNoRefreshToken(item.lineNumber)","messagePattern":"messages\\.rawLineNoRefreshToken\\(item\\.lineNumber\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/hooks/useProviderAccountsPage.ts","lineNumber":336,"sourceCode":"  return Boolean(hasFullTokens || hasRefreshTokenOnly);\n};\n\nconst parseCodexRawRefreshTokenItems = (\n  rawContent: string,\n  messages: ExternalImportBundleParseMessages,\n): unknown[] | null => {\n  const lines = rawContent\n    .split(/\\r?\\n/)\n    .map((line, index) => ({ line: line.trim(), lineNumber: index + 1 }))\n    .filter((item) => item.line.length > 0);\n\n  if (lines.length === 0) return null;\n\n  const items: unknown[] = [];\n  for (const item of lines) {\n    const matches = [...item.line.matchAll(CODEX_REFRESH_TOKEN_PATTERN)];\n    if (matches.length === 0) {\n      throw new Error(messages.rawLineNoRefreshToken(item.lineNumber));\n    }\n    if (matches.length > 1) {\n      throw new Error(messages.rawLineMultipleRefreshTokens(item.lineNumber));\n    }\n\n    const match = matches[0];\n    const refreshToken = match[0].trim();\n    const accountNote = item.line.slice(0, match.index ?? 0).trim();\n    items.push({\n      refresh_token: refreshToken,\n      ...(accountNote ? { account_note: accountNote } : {}),\n    });\n  }\n\n  return items.length > 0 ? items : null;\n};\n\nconst resolveExternalImportBundleItems = (","sourceCodeStart":318,"sourceCodeEnd":354,"githubUrl":"https://github.com/jlcodes99/cockpit-tools/blob/1ed8b77992d62ca81fabf744deb0839ad361d5bf/src/hooks/useProviderAccountsPage.ts#L318-L354","documentation":"When importing codex accounts from raw text, each non-empty line must contain exactly one refresh token matching /rt_[A-Za-z0-9._-]+/g. This error (line 336) means a line contained no refresh token at all, so no account could be constructed from it.","triggerScenarios":"platformId is 'codex', whole-content JSON.parse failed, line-delimited parsing failed, and a non-empty line of the raw content has no substring matching the rt_ token pattern.","commonSituations":"Pasting account notes or labels without the token; lines with truncated tokens missing the rt_ prefix; tokens from another provider with a different prefix; stray header/footer text lines in the paste.","solutions":["Find the reported line number and add/paste the correct refresh token (it must start with rt_)","Remove lines that are notes, headers, or blank labels without tokens","If the token uses a different prefix, convert/export it into the rt_... format expected by codex","Alternatively wrap the data as proper JSON (single bundle or one JSON object per line) to bypass raw parsing"],"exampleFix":"// before (line 3 has no token)\nmy account one\nrt_abc123\nnotes only here\n// after\naccount one rt_abc123\n","handlingStrategy":"validation","validationCode":"const CODEX_TOKEN = /rt_[A-Za-z0-9._-]+/g;\nconst bad = content.split(/\\r?\\n/)\n  .map((l, i) => ({ l: l.trim(), n: i + 1 }))\n  .filter(x => x.l && ![...x.l.matchAll(CODEX_TOKEN)].length);\nif (bad.length) throw new Error(`Line(s) ${bad.map(b => b.n).join(',')} contain no rt_ refresh token`);","typeGuard":"const hasCodexRefreshToken = (line: string): boolean =>\n  /^rt_[A-Za-z0-9._-]+$/.test(line.trim()) ||\n  [...line.matchAll(/rt_[A-Za-z0-9._-]+/g)].length === 1;","tryCatchPattern":"try {\n  items = resolveExternalImportBundleItems(content, 'codex', messages);\n} catch (e) {\n  if (e instanceof Error && /no refresh token/i.test(e.message)) {\n    highlightLineFromMessage(e.message);\n  }\n}","preventionTips":["Put exactly one rt_... token per line in raw format","Check tokens start with rt_ before pasting","Strip header/label lines that contain no token","Use JSON format if lines mix notes and tokens"],"tags":["codex","import","regex","refresh-token"],"backgroundTag":"missing-refresh-token","analyzedSha":"1ed8b77992d62ca81fabf744deb0839ad361d5bf","analyzedAt":"2026-09-05T09:51:41.178Z","contentChangedAt":"2026-09-05T09:51:41.178Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}