{"record":{"id":"fa7dc93d44b10be4","repo":"decolua/9router","slug":"no-authorization-code-received-fa7dc9","errorCode":null,"errorMessage":"No authorization code received","messagePattern":"No authorization code received","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/lib/oauth/services/gemini.js","lineNumber":209,"sourceCode":"        }, 300000);\n\n        const checkInterval = setInterval(() => {\n          if (callbackParams) {\n            clearInterval(checkInterval);\n            clearTimeout(timeout);\n            resolve();\n          }\n        }, 100);\n      });\n\n      close();\n\n      if (callbackParams.error) {\n        throw new Error(callbackParams.error_description || callbackParams.error);\n      }\n\n      if (!callbackParams.code) {\n        throw new Error(\"No authorization code received\");\n      }\n\n      spinner.start(\"Exchanging code for tokens...\");\n\n      // Exchange code for tokens\n      const tokens = await this.exchangeCode(callbackParams.code, redirectUri);\n\n      spinner.text = \"Fetching user info...\";\n\n      // Get user info\n      const userInfo = await this.getUserInfo(tokens.access_token);\n\n      spinner.text = \"Fetching project ID...\";\n\n      // Fetch project ID\n      const projectId = await this.fetchProjectId(tokens.access_token);\n\n      spinner.text = \"Saving tokens to server...\";","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/decolua/9router/blob/90b52e06ffd666b7929554211474d01588f6b1f8/src/lib/oauth/services/gemini.js#L191-L227","documentation":"After the local callback server receives a redirect during Gemini OAuth, connect() expects a `code` query parameter containing the authorization code. If the callback params contain neither an `error` nor a `code`, this \"No authorization code received\" error is thrown at gemini.js:209. It indicates the callback arrived but the OAuth handshake did not deliver what the flow requires.","triggerScenarios":"The redirect to http://localhost:<port>/callback arrived with an empty or unexpected query string — e.g. the user manually navigated to the callback URL, the browser truncated the query params, a redirect loop dropped `code`, or Google redirected for a non-error reason without a code.","commonSituations":"User reloaded or bookmarked the localhost:port/callback URL in the browser while the CLI was waiting; a browser extension or privacy tool stripped query parameters; a misconfigured redirect served the callback page without forwarding the OAuth query string.","solutions":["Re-run the connect flow and let the browser complete the Google authorization without manual edits to the URL.","Close stale tabs pointing at the localhost callback port, then retry so only the fresh redirect hits the server.","Disable extensions that rewrite or strip URLs (privacy/ad blockers) or try another browser for the auth step.","Ensure you are completing the full consent flow and landing back on the callback page automatically, not copying parts of the URL."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"function hasAuthCode(params) {\n  return params && typeof params.code === 'string' && params.code.length > 0;\n}\n// before proceeding: if (!hasAuthCode(callbackParams)) restart the flow instead of continuing;","typeGuard":"function hasAuthorizationCode(params) {\n  return params !== null && typeof params === 'object' && 'code' in params && typeof params.code === 'string';\n}","tryCatchPattern":"try {\n  await geminiService.connect();\n} catch (err) {\n  if (err.message === 'No authorization code received') {\n    console.error('Callback arrived without an authorization code — close stale localhost callback tabs and rerun the connect flow.');\n  }\n  throw err;\n}","preventionTips":["Close any previously open tabs pointing at localhost:<port>/callback before starting a new flow.","Complete the Google consent flow without pausing or editing URLs mid-way.","Disable URL-rewriting browser extensions (privacy/ad blockers) for the auth step or use a clean browser profile.","Avoid bookmarking or reloading the callback URL — it is single-use."],"tags":["oauth","google","callback","authentication"],"backgroundTag":"missing-oauth-authorization-code","analyzedSha":"90b52e06ffd666b7929554211474d01588f6b1f8","analyzedAt":"2026-08-30T21:05:45.952Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}