{"record":{"id":"6227ab347445e4ab","repo":"multica-ai/multica","slug":"pack-plugin-w","errorCode":null,"errorMessage":"pack Plugin: %w","messagePattern":"pack Plugin: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_plugin.go","lineNumber":196,"sourceCode":"}\n\nfunc runPluginValidate(cmd *cobra.Command, args []string) error {\n\t_, artifact, err := loadPluginSource(args[0])\n\tif err != nil {\n\t\treturn fmt.Errorf(\"validate Plugin: %w\", err)\n\t}\n\toutput, _ := cmd.Flags().GetString(\"output\")\n\treturn printPluginDigest(cmd, pluginDigestResult(artifact), output)\n}\n\nfunc runPluginPack(cmd *cobra.Command, args []string) error {\n\toutputPath, _ := cmd.Flags().GetString(\"output\")\n\tif outputPath == \"\" {\n\t\treturn fmt.Errorf(\"--output is required\")\n\t}\n\tarchive, artifact, err := plugincontract.PackDirectory(args[0])\n\tif err != nil {\n\t\treturn fmt.Errorf(\"pack Plugin: %w\", err)\n\t}\n\tif err := os.WriteFile(filepath.Clean(outputPath), archive, 0o644); err != nil {\n\t\treturn fmt.Errorf(\"write Plugin archive: %w\", err)\n\t}\n\tformat, _ := cmd.Flags().GetString(\"format\")\n\treturn printPluginDigest(cmd, pluginDigestResult(artifact), format)\n}\n\nfunc pluginWorkspaceID(cmd *cobra.Command) (string, error) {\n\tworkspace, _ := cmd.Flags().GetString(\"workspace\")\n\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","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_plugin.go#L178-L214","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nmultica plugin pack dist --output p.zip   // cwd wrong, dist/ absent\n// pack Plugin: stat dist: no such file or directory\n\n// after\ncd plugin-root\nmultica plugin pack . --output ./dist/plugin.zip","handlingStrategy":"validation","validationCode":"if _, err := os.Stat(pluginDir); err != nil { return fmt.Errorf(\"plugin dir missing: %w\", err) }\nif _, err := os.Stat(filepath.Join(pluginDir, \"plugin.yaml\")); err != nil { return fmt.Errorf(\"manifest missing: %w\", err) }","typeGuard":null,"tryCatchPattern":"if err := packCmd.Run(); err != nil {\n    if strings.Contains(err.Error(), \"pack Plugin\") { /* inspect wrapped cause: fs vs manifest vs size */ }\n}","preventionTips":["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."],"tags":["cli","plugin","filesystem","go"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}