paperclipai/paperclip · error · Error
Select a company to create environments
Error message
Select a company to create environments
What it means
Guard in the environmentMutation mutationFn (create branch): creating an environment requires a selectedCompanyId, and the company selector context is empty, so the create path aborts client-side before calling environmentsApi.create.
Source
Thrown at ui/src/pages/CompanyEnvironments.tsx:1413
},
onError: (error) => {
pushToast({
title: "Failed to save environment variables",
body: error instanceof Error ? error.message : "Environment variables save failed.",
tone: "error",
});
},
});
const environmentMutation = useMutation({
mutationFn: async (form: EnvironmentFormState) => {
const body = buildEnvironmentPayload(form);
if (editingEnvironmentId) {
return await environmentsApi.update(editingEnvironmentId, body, selectedCompanyId);
}
if (!selectedCompanyId) throw new Error("Select a company to create environments");
return await environmentsApi.create(selectedCompanyId!, body);
},
onSuccess: async (environment) => {
const wasEditing = editingEnvironmentId !== null;
if (selectedCompanyId) {
await queryClient.invalidateQueries({
queryKey: queryKeys.environments.list(selectedCompanyId),
});
}
await queryClient.invalidateQueries({
queryKey: queryKeys.environments.customImageTemplate(environment.id),
});
initializedFormKeyRef.current = null;
setEnvironmentForm(createEmptyEnvironmentForm());
setEnvironmentFormBaselineKey(null);
setEnvironmentVariablesDirty(false);
environmentMutation.reset();
draftEnvironmentProbeMutation.reset();View on GitHub (pinned to a7e689b3c3)
Solutions
- Select a company from the company picker before creating environments.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at ui/src/pages/CompanyEnvironments.tsx:1385 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of paperclipai/paperclip@a7e689b3c3 (2026-08-18).
Data as JSON: /api/errors/8825341af8f7aa8a.
Report an issue: GitHub.