multica-ai/multica · error

validate Plugin before install: %w

Error message

validate Plugin before install: %w

What it means

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.

Source

Thrown at server/cmd/multica/cmd_plugin.go:225

	if workspace == "" {
		return requireWorkspaceID(cmd)
	}
	ctx, cancel := cli.APIContext(context.Background())
	defer cancel()
	resolved, err := resolveWorkspaceRef(ctx, cmd, workspace)
	if err != nil {
		return "", err
	}
	return resolved.ID, nil
}

func runPluginInstall(cmd *cobra.Command, args []string) error {
	if err := requireHumanLocalCommand("plugin install"); err != nil {
		return err
	}
	archive, artifact, err := loadPluginSource(args[0])
	if err != nil {
		return fmt.Errorf("validate Plugin before install: %w", err)
	}
	workspaceID, err := pluginWorkspaceID(cmd)
	if err != nil {
		return err
	}
	client, err := newAPIClient(cmd)
	if err != nil {
		return err
	}
	client.WorkspaceID = workspaceID
	ctx, cancel := context.WithTimeout(context.Background(), cli.AtLeastAPITimeout(time.Minute))
	defer cancel()
	var result map[string]any
	path := "/api/workspaces/" + workspaceID + "/plugins/private/install"
	if err := client.UploadPrivatePlugin(ctx, path, archive, artifact.Manifest.Metadata.Key+"-"+artifact.Manifest.Metadata.Version+".zip", &result); err != nil {
		return fmt.Errorf("install Private Plugin: %w", err)
	}
	output, _ := cmd.Flags().GetString("output")

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Run `multica plugin validate <source>` — it exercises the same loadPluginSource path and surfaces the exact cause without the install context.
  2. Re-pack from a known-good directory: `multica plugin pack ./my-plugin --output fresh.zip` and install that.
  3. Fix the manifest fields named in the wrapped error and rebuild the zip.
  4. Verify the artifact size is under plugincontract.MaxArchiveSize.

Example fix

// before
multica plugin install ./plugin.zip   // validate Plugin before install: manifest: compatibility.host_api: invalid semver range

// after (plugin.yaml)
# compatibility:
#   host_api: ">=1.0.0 <2.0.0"
multica plugin pack ./my-plugin --output ./plugin.zip && multica plugin install ./plugin.zip
Defensive patterns

Strategy: validation

Validate before calling

if _, _, err := loadPluginSource(source); err != nil {
    return fmt.Errorf("install pre-flight: %w", err) // run before mutating any server state
}

Try / catch

if err := installCmd.Run(); err != nil {
    if strings.Contains(err.Error(), "validate Plugin before install") {
        // purely local failure — safe to fix and retry, no server state touched
    }
}

Prevention

When it happens

Trigger: Installing a missing path, a non-regular file, an oversize zip, an unreadable directory, or an archive whose manifest fails plugincontract.ValidateArtifact.

Common situations: 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.

Related errors


AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15). Data as JSON: /api/errors/b2a3427ea6997ff3. Report an issue: GitHub.