{"record":{"id":"b2a3427ea6997ff3","repo":"multica-ai/multica","slug":"validate-plugin-before-install-w","errorCode":null,"errorMessage":"validate Plugin before install: %w","messagePattern":"validate Plugin before install: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_plugin.go","lineNumber":225,"sourceCode":"\tif workspace == \"\" {\n\t\treturn requireWorkspaceID(cmd)\n\t}\n\tctx, cancel := cli.APIContext(context.Background())\n\tdefer cancel()\n\tresolved, err := resolveWorkspaceRef(ctx, cmd, workspace)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn resolved.ID, nil\n}\n\nfunc runPluginInstall(cmd *cobra.Command, args []string) error {\n\tif err := requireHumanLocalCommand(\"plugin install\"); err != nil {\n\t\treturn err\n\t}\n\tarchive, artifact, err := loadPluginSource(args[0])\n\tif err != nil {\n\t\treturn fmt.Errorf(\"validate Plugin before install: %w\", err)\n\t}\n\tworkspaceID, err := pluginWorkspaceID(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\tclient, err := newAPIClient(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\tclient.WorkspaceID = workspaceID\n\tctx, cancel := context.WithTimeout(context.Background(), cli.AtLeastAPITimeout(time.Minute))\n\tdefer cancel()\n\tvar result map[string]any\n\tpath := \"/api/workspaces/\" + workspaceID + \"/plugins/private/install\"\n\tif err := client.UploadPrivatePlugin(ctx, path, archive, artifact.Manifest.Metadata.Key+\"-\"+artifact.Manifest.Metadata.Version+\".zip\", &result); err != nil {\n\t\treturn fmt.Errorf(\"install Private Plugin: %w\", err)\n\t}\n\toutput, _ := cmd.Flags().GetString(\"output\")","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_plugin.go#L207-L243","documentation":"Wrap in runPluginInstall (cmd_plugin.go:225): `multica plugin install <source>` failed while loading/validating the source via loadPluginSource BEFORE any network call or workspace resolution. It aggregates errors 563-565 plus read/ValidateArtifact failures; the 'validate Plugin before install' wording makes explicit that local validation precedes upload.","triggerScenarios":"Installing a missing path, a non-regular file, an oversize zip, an unreadable directory, or an archive whose manifest fails plugincontract.ValidateArtifact.","commonSituations":"Installing a zip built for a different plugin contract version; hand-edited manifest with bad semver range in compatibility.host_api; stale artifact from an older `plugin pack` run.","solutions":["Run `multica plugin validate <source>` — it exercises the same loadPluginSource path and surfaces the exact cause without the install context.","Re-pack from a known-good directory: `multica plugin pack ./my-plugin --output fresh.zip` and install that.","Fix the manifest fields named in the wrapped error and rebuild the zip.","Verify the artifact size is under plugincontract.MaxArchiveSize."],"exampleFix":"// before\nmultica plugin install ./plugin.zip   // validate Plugin before install: manifest: compatibility.host_api: invalid semver range\n\n// after (plugin.yaml)\n# compatibility:\n#   host_api: \">=1.0.0 <2.0.0\"\nmultica plugin pack ./my-plugin --output ./plugin.zip && multica plugin install ./plugin.zip","handlingStrategy":"validation","validationCode":"if _, _, err := loadPluginSource(source); err != nil {\n    return fmt.Errorf(\"install pre-flight: %w\", err) // run before mutating any server state\n}","typeGuard":null,"tryCatchPattern":"if err := installCmd.Run(); err != nil {\n    if strings.Contains(err.Error(), \"validate Plugin before install\") {\n        // purely local failure — safe to fix and retry, no server state touched\n    }\n}","preventionTips":["Make `plugin validate` a mandatory CI stage before any install.","Repack from source on every install rather than reusing old zips.","Pin the plugin contract version so manifest schemas cannot drift."],"tags":["cli","plugin","validation","install","go"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}