paperclipai/paperclip · error
Select a company first.
Error message
Select a company first.
What it means
UI membership mutation guard: the mutation was triggered while no company is selected (companyId null/undefined). It fails fast instead of sending a request with an undefined company path segment; the surrounding UI should disable membership actions until a company context exists.
Source
Thrown at ui/src/hooks/useResourceMemberships.ts:154
return Array.isArray(ids) ? ids : [];
}
export function useResourceMemberships(companyId: string | null | undefined) {
return useQuery({
queryKey: queryKeys.resourceMemberships.mine(companyId ?? "__none__"),
queryFn: () => resourceMembershipsApi.listMine(companyId!),
enabled: !!companyId,
});
}
export function useResourceMembershipMutation(companyId: string | null | undefined) {
const queryClient = useQueryClient();
const { pushToast } = useToastActions();
const queryKey = queryKeys.resourceMemberships.mine(companyId ?? "__none__");
return useMutation({
mutationFn: (variables: MutationVariables) => {
if (!companyId) throw new Error("Select a company first.");
const body = { state: variables.state, starred: variables.starred };
return variables.resourceType === "project"
? resourceMembershipsApi.updateProject(companyId, variables.resourceId, body)
: resourceMembershipsApi.updateAgent(companyId, variables.resourceId, body);
},
onMutate: async (variables) => {
await queryClient.cancelQueries({ queryKey });
const previous = queryClient.getQueryData<ResourceMemberships>(queryKey);
queryClient.setQueryData<ResourceMemberships>(
queryKey,
applyMembershipChange(previous, variables.resourceType, variables.resourceId, {
state: variables.state,
starred: variables.starred,
}),
);
return { previous };
},
onError: (error, variables, context) => {View on GitHub (pinned to 120ae5428f)
Solutions
- Select a company from the company picker before managing resource memberships.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at ui/src/hooks/useResourceMemberships.ts:154 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of paperclipai/paperclip@120ae5428f (2026-08-18).
Data as JSON: /api/errors/752b18b075f41027.
Report an issue: GitHub.