{"record":{"id":"d7d50666556a2a42","repo":"jackwener/OpenCLI","slug":"request-failed-d7d506","errorCode":"REQUEST_FAILED","errorMessage":"Failed to read Gitee user profile API: ${apiResponse.status}","messagePattern":"Failed to read Gitee user profile API: (.+?)","errorType":"error_code","errorClass":"CliError","httpStatus":null,"severity":"error","filePath":"clis/gitee/user.js","lineNumber":185,"sourceCode":"        if (domSnapshot.notFound) {\n            throw new CliError('NOT_FOUND', `Gitee user \"${username}\" does not exist`, 'Check the username and retry: opencli gitee user <username>');\n        }\n        if (domSnapshot.blocked) {\n            throw new CliError('FORBIDDEN', `Gitee user page \"${username}\" is not accessible`, 'The profile may be private/restricted, or the account may be unavailable');\n        }\n        const apiUrl = `${GITEE_USER_API}/${encodeURIComponent(username)}`;\n        const apiResponse = await fetch(apiUrl, {\n            headers: {\n                Accept: 'application/json',\n                'User-Agent': 'Mozilla/5.0',\n                Referer: profileUrl,\n            },\n        });\n        if (apiResponse.status === 404) {\n            throw new CliError('NOT_FOUND', `Gitee user \"${username}\" does not exist`, 'Check the username and retry: opencli gitee user <username>');\n        }\n        if (!apiResponse.ok) {\n            throw new CliError('REQUEST_FAILED', `Failed to read Gitee user profile API: ${apiResponse.status}`, 'Try again later or verify network access to gitee.com');\n        }\n        const apiUser = asRecord(await apiResponse.json());\n        const nickname = pickFirst(domSnapshot.nickname, firstText(apiUser?.name), firstText(apiUser?.login), username);\n        const followers = pickFirst(domSnapshot.followers, normalizeCount(apiUser?.followers), '-');\n        const publicRepos = pickFirst(domSnapshot.publicRepos, normalizeCount(apiUser?.public_repos), '-');\n        const giteeIndex = pickFirst(domSnapshot.giteeIndex, apiGiteeIndex(apiUser), '-');\n        return [\n            { field: 'Nickname', value: nickname },\n            { field: 'Followers', value: followers },\n            { field: 'Public Repositories', value: publicRepos },\n            { field: 'Gitee Index', value: giteeIndex },\n            { field: 'URL', value: profileUrl },\n        ];\n    },\n});\n","sourceCodeStart":167,"sourceCodeEnd":201,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/gitee/user.js#L167-L201","documentation":"Thrown when the Gitee user profile API responds with a non-OK, non-404 status (e.g. 403 rate-limit, 500/502 server error). The CLI cannot read the profile and surfaces the upstream HTTP status in the message with a REQUEST_FAILED code, advising a retry or network check. It indicates a transient or upstream problem, not a bad username.","triggerScenarios":"`fetch` to the Gitee profile API returns status >= 400 and != 404 — for example 403 from rate limiting/anti-bot protection, 5xx from a Gitee outage, or a proxy returning an error status.","commonSituations":"Gitee rate-limiting anonymous API calls after repeated runs; corporate proxy or firewall intercepting requests; temporary gitee.com outage or maintenance; network DNS/connectivity problems surfacing as gateway errors.","solutions":["Retry the command after a short delay (the failure is often transient)","Check general access to gitee.com from your environment (browser or curl)","If behind a proxy/corporate network, configure proxy env vars or use a network with access to gitee.com","If rate-limited, wait before retrying or use an authenticated access token if the CLI supports it"],"exampleFix":"// before (in a tight loop)\nfor (const u of users) await opencli gitee user u;\n// after (backoff between calls)\nfor (const u of users) { await opencli gitee user u; await new Promise(r => setTimeout(r, 2000)); }","handlingStrategy":"retry","validationCode":"const ok = await fetch('https://gitee.com', { method: 'HEAD' }).then(r => r.ok).catch(() => false);\nif (!ok) throw new Error('gitee.com unreachable from this environment');","typeGuard":"function isRequestFailed(e) { return e instanceof Error && e.code === 'REQUEST_FAILED'; }","tryCatchPattern":"try {\n  await run(['opencli', 'gitee', 'user', username]);\n} catch (e) {\n  if (e.code === 'REQUEST_FAILED' && attempt < 3) return retryWithBackoff(attempt + 1);\n  throw e;\n}","preventionTips":["Add exponential backoff retries for transient upstream failures","Space out bulk lookups to avoid rate limits","Verify proxy/network access to gitee.com in CI environments before running"],"tags":["gitee","network","http-error","cli"],"backgroundTag":"upstream-request-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}