{"record":{"id":"24c2c144e070da28","repo":"paperclipai/paperclip","slug":"select-a-company-before-testing-plugin-configurati","errorCode":null,"errorMessage":"Select a company before testing plugin configuration.","messagePattern":"Select a company before testing plugin configuration\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"ui/src/pages/PluginSettings.tsx","lineNumber":1005,"sourceCode":"    },\n    onSuccess: () => {\n      setSaveMessage({ type: \"success\", text: \"Configuration saved.\" });\n      setTestResult(null);\n      if (companyId) {\n        queryClient.invalidateQueries({ queryKey: queryKeys.plugins.config(pluginId, companyId) });\n      }\n      // Clear success message after 3s\n      setTimeout(() => setSaveMessage(null), 3000);\n    },\n    onError: (err: Error) => {\n      setSaveMessage({ type: \"error\", text: err.message || \"Failed to save configuration.\" });\n    },\n  });\n\n  // Test configuration mutation\n  const testMutation = useMutation({\n    mutationFn: (configJson: Record<string, unknown>) => {\n      if (!companyId) throw new Error(\"Select a company before testing plugin configuration.\");\n      return pluginsApi.testConfig(pluginId, companyId, configJson);\n    },\n    onSuccess: (result) => {\n      if (result.valid) {\n        setTestResult({ type: \"success\", text: \"Configuration test passed.\" });\n      } else {\n        setTestResult({ type: \"error\", text: result.message || \"Configuration test failed.\" });\n      }\n    },\n    onError: (err: Error) => {\n      setTestResult({ type: \"error\", text: err.message || \"Configuration test failed.\" });\n    },\n  });\n\n  const handleChange = useCallback((newValues: Record<string, unknown>) => {\n    setValues(newValues);\n    // Clear field-level errors as the user types\n    setErrors({});","sourceCodeStart":987,"sourceCodeEnd":1023,"githubUrl":"https://github.com/paperclipai/paperclip/blob/a7e689b3c35347b529cb9f54c9b9a8575a3dcab6/ui/src/pages/PluginSettings.tsx#L987-L1023","documentation":"Scope guard in the PluginConfigForm testMutation: testing a plugin configuration executes against a company-scoped test endpoint, but no company is selected, so the test cannot be routed and aborts client-side.","triggerScenarios":"Thrown at ui/src/pages/PluginSettings.tsx:1006 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Select a company from the company picker before testing the plugin configuration."],"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"}