{"record":{"id":"e0814c8b8e51d409","repo":"strapi/strapi","slug":"error-fetching-cloud-environments-from-the-server","errorCode":null,"errorMessage":"Error fetching cloud environments from the server.","messagePattern":"Error fetching cloud environments from the server\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/cloud/src/services/cli-api.ts","lineNumber":249,"sourceCode":"        if (response.status !== 200) {\n          throw new Error('Error fetching cloud projects from the server.');\n        }\n\n        return response;\n      } catch (error) {\n        logger.debug(\n          \"🥲 Oops! Couldn't retrieve your project's list from the server. Please try again.\"\n        );\n        throw error;\n      }\n    },\n\n    async listEnvironments({ name }): Promise<AxiosResponse<ListEnvironmentsResponse>> {\n      try {\n        const response = await axiosCloudAPI.get(`/projects/${name}/environments`);\n\n        if (response.status !== 200) {\n          throw new Error('Error fetching cloud environments from the server.');\n        }\n\n        return response;\n      } catch (error) {\n        logger.debug(\n          \"🥲 Oops! Couldn't retrieve your project's environments from the server. Please try again.\"\n        );\n        throw error;\n      }\n    },\n\n    async listLinkEnvironments({ name }): Promise<AxiosResponse<ListLinkEnvironmentsResponse>> {\n      try {\n        const response = await axiosCloudAPI.get(`/projects/${name}/environments-linkable`);\n\n        if (response.status !== 200) {\n          throw new Error('Error fetching cloud environments from the server.');\n        }","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/strapi/strapi/blob/4a4101264d7098754df36e85fa629fd2f2349d8c/packages/cli/cloud/src/services/cli-api.ts#L231-L267","documentation":"Thrown by cloudApiService.listEnvironments() when GET /projects/{name}/environments returns a non-200 status, then re-thrown after a debug log. Supplies the environments for a specific cloud project.","triggerScenarios":"A command calls listEnvironments({ name }) with a project name; the server responds with status !== 200 (e.g. 404 for an unknown project, 403, or 5xx).","commonSituations":"Project name in .strapi-cloud.json is stale/renamed/deleted (404); token expired (401); permission denied (403); cloud API incident (5xx); name has URL-unsafe characters that were not encoded.","solutions":["Re-link the project with `strapi clouds:link` to refresh the stored project name.","Run `strapi login` to refresh credentials.","Confirm the project exists in the dashboard and the account has access.","Retry for transient 5xx.","Update the CLI and check DEBUG logs."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (!project?.name) throw new Error('Project name missing; run strapi clouds:link.');\nconst name = encodeURIComponent(project.name);","typeGuard":"const hasName = (p: unknown): p is { name: string } =>\n  typeof p === 'object' && p !== null && typeof (p as any).name === 'string';","tryCatchPattern":"try {\n  const envs = await cloudApiService.listEnvironments({ name: project.name });\n} catch (e) {\n  if (e?.response?.status === 404) ctx.logger.warn('Project not found. Re-link with `strapi clouds:link`.');\n  else ctx.logger.error('Could not list environments.');\n  ctx.logger.debug(e);\n}","preventionTips":["URL-encode the project name when it may contain special characters.","Handle 404 by re-linking; handle 401 by re-login.","Keep the stored project name in sync with the dashboard."],"tags":["strapi-cloud","api","environments","network","cli"],"backgroundTag":null,"analyzedSha":"4a4101264d7098754df36e85fa629fd2f2349d8c","analyzedAt":"2026-08-12T12:47:50.760Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}