{"record":{"id":"6f17c2b20c3534ad","repo":"diegosouzapw/OmniRoute","slug":"grok-returned-an-invalid-device-code","errorCode":null,"errorMessage":"Grok returned an invalid device code","messagePattern":"Grok returned an invalid device code","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/lib/oauth/providers/grok-cli.ts","lineNumber":133,"sourceCode":"  });\n  const data = await parseOAuthResponse(response);\n\n  if (!response.ok) {\n    throw new Error(\n      typeof data.error_description === \"string\"\n        ? data.error_description\n        : \"Grok device authorization failed\"\n    );\n  }\n  if (\n    typeof data.device_code !== \"string\" ||\n    typeof data.user_code !== \"string\" ||\n    typeof data.verification_uri !== \"string\"\n  ) {\n    throw new Error(\"Grok device authorization response is incomplete\");\n  }\n  if (!/^[A-Za-z0-9-]+$/.test(data.user_code)) {\n    throw new Error(\"Grok returned an invalid device code\");\n  }\n  validateVerificationUri(data.verification_uri);\n  if (typeof data.verification_uri_complete === \"string\") {\n    validateVerificationUri(data.verification_uri_complete);\n  }\n\n  return {\n    device_code: data.device_code,\n    user_code: data.user_code,\n    verification_uri: data.verification_uri,\n    verification_uri_complete:\n      typeof data.verification_uri_complete === \"string\"\n        ? data.verification_uri_complete\n        : data.verification_uri,\n    expires_in: typeof data.expires_in === \"number\" ? data.expires_in : 1800,\n    interval: typeof data.interval === \"number\" ? data.interval : 5,\n  };\n}","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/oauth/providers/grok-cli.ts#L115-L151","documentation":"Error \"Grok returned an invalid device code\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/oauth/providers/grok-cli.ts:133 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":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}