multica-ai/multica · error
pack Plugin: %w
Error message
pack Plugin: %w
What it means
Wrap in runPluginPack (cmd_plugin.go:196): plugincontract.PackDirectory on the input directory failed before any archive was produced. PackDirectory walks the directory, reads files, builds the zip, and validates the resulting artifact — failures include unreadable/missing directory, files disappearing mid-walk, permissions, packing exceeding MaxArchiveSize, or the generated artifact failing ValidateArtifact (manifest problems).
Source
Thrown at server/cmd/multica/cmd_plugin.go:196
}
func runPluginValidate(cmd *cobra.Command, args []string) error {
_, artifact, err := loadPluginSource(args[0])
if err != nil {
return fmt.Errorf("validate Plugin: %w", err)
}
output, _ := cmd.Flags().GetString("output")
return printPluginDigest(cmd, pluginDigestResult(artifact), output)
}
func runPluginPack(cmd *cobra.Command, args []string) error {
outputPath, _ := cmd.Flags().GetString("output")
if outputPath == "" {
return fmt.Errorf("--output is required")
}
archive, artifact, err := plugincontract.PackDirectory(args[0])
if err != nil {
return fmt.Errorf("pack Plugin: %w", err)
}
if err := os.WriteFile(filepath.Clean(outputPath), archive, 0o644); err != nil {
return fmt.Errorf("write Plugin archive: %w", err)
}
format, _ := cmd.Flags().GetString("format")
return printPluginDigest(cmd, pluginDigestResult(artifact), format)
}
func pluginWorkspaceID(cmd *cobra.Command) (string, error) {
workspace, _ := cmd.Flags().GetString("workspace")
if workspace == "" {
return requireWorkspaceID(cmd)
}
ctx, cancel := cli.APIContext(context.Background())
defer cancel()
resolved, err := resolveWorkspaceRef(ctx, cmd, workspace)
if err != nil {
return "", errView on GitHub (pinned to 2c0912b6ec)
Solutions
- Confirm the directory exists and is readable from the shell you are running in: `ls plugin.yaml <dir>`.
- Read the wrapped cause — 'exceeds' means shrink contents (exclude node_modules etc.), manifest errors mean fix plugin.yaml.
- Re-run `multica plugin validate <dir>` first to isolate contract problems from packing problems.
- Close editors/builds holding exclusive file locks, then retry.
Example fix
// before multica plugin pack dist --output p.zip // cwd wrong, dist/ absent // pack Plugin: stat dist: no such file or directory // after cd plugin-root multica plugin pack . --output ./dist/plugin.zip
Defensive patterns
Strategy: validation
Validate before calling
if _, err := os.Stat(pluginDir); err != nil { return fmt.Errorf("plugin dir missing: %w", err) }
if _, err := os.Stat(filepath.Join(pluginDir, "plugin.yaml")); err != nil { return fmt.Errorf("manifest missing: %w", err) } Try / catch
if err := packCmd.Run(); err != nil {
if strings.Contains(err.Error(), "pack Plugin") { /* inspect wrapped cause: fs vs manifest vs size */ }
} Prevention
- Assert plugin.yaml exists at the dir root before packing.
- Pack from the plugin root with absolute paths.
- Validate first (`plugin validate <dir>`) — it exercises the same contract checks more cheaply.
When it happens
Trigger: Input dir does not exist or lacks read permission; a file inside is unreadable; total packed size exceeds MaxArchiveSize; the directory's manifest is missing/invalid so the packed artifact fails validation.
Common situations: Packing from the wrong cwd (relative path resolves elsewhere); plugin folder missing plugin.yaml; build artifacts locked by another process on Windows; dir contains a huge dependency tree.
Related errors
- plugin directory %q is not empty
- inspect plugin directory: %w
- plugin source %q is not a directory or regular ZIP
- write Plugin archive: %w
- read --%s-file: %w
AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15).
Data as JSON: /api/errors/6227ab347445e4ab.
Report an issue: GitHub.