{"record":{"id":"022c442eccaafee7","repo":"paperclipai/paperclip","slug":"select-a-company-before-uploading-a-profile-avatar","errorCode":null,"errorMessage":"Select a company before uploading a profile avatar.","messagePattern":"Select a company before uploading a profile avatar\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"ui/src/pages/ProfileSettings.tsx","lineNumber":90,"sourceCode":"    return name.trim() || sessionQuery.data?.user.name || \"Board\";\n  }\n\n  const updateMutation = useMutation({\n    mutationFn: (input: UpdateCurrentUserProfile) => persistProfile(input),\n    onSuccess: (profile) => {\n      setActionError(null);\n      setName(profile.name ?? \"\");\n      setImage(profile.image ?? \"\");\n    },\n    onError: (error) => {\n      setActionError(error instanceof Error ? error.message : \"Failed to update profile.\");\n    },\n  });\n\n  const uploadAvatarMutation = useMutation({\n    mutationFn: async (file: File) => {\n      if (!selectedCompanyId) {\n        throw new Error(\"Select a company before uploading a profile avatar.\");\n      }\n\n      const asset = await assetsApi.uploadImage(\n        selectedCompanyId,\n        file,\n        `profiles/${sessionQuery.data?.user.id ?? \"board-user\"}`,\n      );\n      return persistProfile({ name: resolveProfileName(), image: asset.contentPath });\n    },\n    onSuccess: (profile) => {\n      setActionError(null);\n      setName(profile.name ?? \"\");\n      setImage(profile.image ?? \"\");\n    },\n    onError: (error) => {\n      setActionError(error instanceof Error ? error.message : \"Failed to upload avatar.\");\n    },\n  });","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/paperclipai/paperclip/blob/a7e689b3c35347b529cb9f54c9b9a8575a3dcab6/ui/src/pages/ProfileSettings.tsx#L72-L108","documentation":"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.","triggerScenarios":"Thrown at ui/src/pages/ProfileSettings.tsx:91 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Select a company from the company picker before uploading a profile avatar."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a7e689b3c35347b529cb9f54c9b9a8575a3dcab6","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}