paperclipai/paperclip · error · Error

Select a company before uploading a profile avatar.

Error message

Select a company before uploading a profile avatar.

What it means

Scope guard in the avatar upload mutation on ProfileSettings: avatar storage is keyed per company, and selectedCompanyId is falsy, so the upload has no destination bucket. The mutation throws before reading/uploading the file.

Source

Thrown at ui/src/pages/ProfileSettings.tsx:90

    return name.trim() || sessionQuery.data?.user.name || "Board";
  }

  const updateMutation = useMutation({
    mutationFn: (input: UpdateCurrentUserProfile) => persistProfile(input),
    onSuccess: (profile) => {
      setActionError(null);
      setName(profile.name ?? "");
      setImage(profile.image ?? "");
    },
    onError: (error) => {
      setActionError(error instanceof Error ? error.message : "Failed to update profile.");
    },
  });

  const uploadAvatarMutation = useMutation({
    mutationFn: async (file: File) => {
      if (!selectedCompanyId) {
        throw new Error("Select a company before uploading a profile avatar.");
      }

      const asset = await assetsApi.uploadImage(
        selectedCompanyId,
        file,
        `profiles/${sessionQuery.data?.user.id ?? "board-user"}`,
      );
      return persistProfile({ name: resolveProfileName(), image: asset.contentPath });
    },
    onSuccess: (profile) => {
      setActionError(null);
      setName(profile.name ?? "");
      setImage(profile.image ?? "");
    },
    onError: (error) => {
      setActionError(error instanceof Error ? error.message : "Failed to upload avatar.");
    },
  });

View on GitHub (pinned to a7e689b3c3)

Solutions

  1. Select a company from the company picker before uploading a profile avatar.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at ui/src/pages/ProfileSettings.tsx:91 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/022c442eccaafee7. Report an issue: GitHub.