{"record":{"id":"7a07b2843b877b0d","repo":"multica-ai/multica","slug":"write-plugin-archive-w","errorCode":null,"errorMessage":"write Plugin archive: %w","messagePattern":"write Plugin archive: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_plugin.go","lineNumber":199,"sourceCode":"\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\n\t}\n\treturn resolved.ID, nil\n}","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_plugin.go#L181-L217","documentation":"Wrap in runPluginPack (cmd_plugin.go:199): the archive was built and validated successfully, but writing it to the cleaned --output path failed. This is a pure filesystem error at the final step — unwritable directory, path is a directory, disk full, or permission denied.","triggerScenarios":"--output points into a non-existent directory; output path is itself a directory; no write permission; ENOSPC; read-only filesystem.","commonSituations":"Forgetting `mkdir -p dist`; running as a user without write access to the target; CI container with a read-only mount at the output location.","solutions":["Create the parent directory: `mkdir -p $(dirname <output>)`.","Check the path is free: `ls -ld <output>` — remove it if it is an existing directory.","Verify write permission and disk space (`df -h .`), then retry."],"exampleFix":"// before\nmultica plugin pack . --output ./dist/plugin.zip   // dist/ absent -> write Plugin archive: no such file or directory\n\n// after\nmkdir -p dist && multica plugin pack . --output ./dist/plugin.zip","handlingStrategy":"validation","validationCode":"if err := os.MkdirAll(filepath.Dir(outputPath), 0o755); err != nil { return err }\nif fi, err := os.Stat(outputPath); err == nil && fi.IsDir() { return fmt.Errorf(\"output %s is a directory\", outputPath) }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["mkdir -p the output directory in the same script step as pack.","Use a fresh versioned filename per build (plugin-0.1.1.zip) to avoid clobbering/dir conflicts.","Check df/permissions in CI before the build job."],"tags":["cli","filesystem","permissions","plugin","go"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}