{"record":{"id":"917568835993c4fb","repo":"paperclipai/paperclip","slug":"select-a-secret-first","errorCode":null,"errorMessage":"Select a secret first","messagePattern":"Select a secret first","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"ui/src/pages/Secrets.tsx","lineNumber":1144,"sourceCode":"        providerConfigId: getDefaultProviderConfigId(providerConfigs, createForm.provider),\n      });\n      setCreateError(null);\n      if (result.kind === \"company\") {\n        setDetailSelection(result.item.id);\n        invalidateAll([result.item.id]);\n      } else {\n        setDetailSelection(null, result.item.id);\n        invalidateAll([result.item.id]);\n      }\n    },\n    onError: (error) => {\n      setCreateError(error);\n    },\n  });\n\n  const rotateMutation = useMutation({\n    mutationFn: () => {\n      if (!selectedSecret) throw new Error(\"Select a secret first\");\n      if (selectedSecret.managedMode === \"external_reference\" && rotateMode === \"reference\") {\n        return secretsApi.rotate(selectedSecret.id, {\n          externalRef: rotateExternalRef.trim() || selectedSecret.externalRef || undefined,\n          providerConfigId: rotateProviderConfigId || null,\n        });\n      }\n      return secretsApi.rotate(selectedSecret.id, {\n        value: rotateValue,\n        providerConfigId: rotateProviderConfigId || null,\n      });\n    },\n    onSuccess: (updated) => {\n      pushToast({ title: \"Rotated\", body: `${updated.name} → v${updated.latestVersion}`, tone: \"success\" });\n      setRotateOpen(false);\n      setRotateValue(\"\");\n      setRotateExternalRef(\"\");\n      setRotateProviderConfigId(\"\");\n      setRotateError(null);","sourceCodeStart":1126,"sourceCodeEnd":1162,"githubUrl":"https://github.com/paperclipai/paperclip/blob/a7e689b3c35347b529cb9f54c9b9a8575a3dcab6/ui/src/pages/Secrets.tsx#L1126-L1162","documentation":"Selection guard in the Secrets rotateMutation: rotation operates on a specific secret, but selectedSecret is null (no row chosen in the detail pane), so the mutation refuses to run rather than sending a rotation request without a target id.","triggerScenarios":"Thrown at ui/src/pages/Secrets.tsx:1144 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Select a secret from the list before performing this action."],"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-14T00:17:10.932Z"}