strapi/strapi · error
Error fetching cloud environments from the server.
Error message
Error fetching cloud environments from the server.
What it means
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.
Source
Thrown at packages/cli/cloud/src/services/cli-api.ts:249
if (response.status !== 200) {
throw new Error('Error fetching cloud projects from the server.');
}
return response;
} catch (error) {
logger.debug(
"🥲 Oops! Couldn't retrieve your project's list from the server. Please try again."
);
throw error;
}
},
async listEnvironments({ name }): Promise<AxiosResponse<ListEnvironmentsResponse>> {
try {
const response = await axiosCloudAPI.get(`/projects/${name}/environments`);
if (response.status !== 200) {
throw new Error('Error fetching cloud environments from the server.');
}
return response;
} catch (error) {
logger.debug(
"🥲 Oops! Couldn't retrieve your project's environments from the server. Please try again."
);
throw error;
}
},
async listLinkEnvironments({ name }): Promise<AxiosResponse<ListLinkEnvironmentsResponse>> {
try {
const response = await axiosCloudAPI.get(`/projects/${name}/environments-linkable`);
if (response.status !== 200) {
throw new Error('Error fetching cloud environments from the server.');
}View on GitHub (pinned to 4a4101264d)
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.
Defensive patterns
Strategy: try-catch
Validate before calling
if (!project?.name) throw new Error('Project name missing; run strapi clouds:link.');
const name = encodeURIComponent(project.name); Type guard
const hasName = (p: unknown): p is { name: string } =>
typeof p === 'object' && p !== null && typeof (p as any).name === 'string'; Try / catch
try {
const envs = await cloudApiService.listEnvironments({ name: project.name });
} catch (e) {
if (e?.response?.status === 404) ctx.logger.warn('Project not found. Re-link with `strapi clouds:link`.');
else ctx.logger.error('Could not list environments.');
ctx.logger.debug(e);
} Prevention
- 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.
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- Error fetching cloud CLI config from the server.
- Error fetching cloud projects from the server.
- Error fetching project's details.
- Error creating trial.
- Environment details ${targetEnvironment} not found.
AI-assisted analysis of strapi/strapi@4a4101264d (2026-08-12).
Data as JSON: /api/errors/e0814c8b8e51d409.
Report an issue: GitHub.