{"record":{"id":"36fd0416364d3d6e","repo":"multica-ai/multica","slug":"read-file-for-content-file-w","errorCode":null,"errorMessage":"read file for --content-file: %w","messagePattern":"read file for --content-file: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_skill.go","lineNumber":211,"sourceCode":"\t}\n\tif filePath != \"\" {\n\t\tsources++\n\t}\n\tif sources > 1 {\n\t\treturn \"\", false, fmt.Errorf(\"--content, --content-stdin, and --content-file are mutually exclusive\")\n\t}\n\n\tif useStdin {\n\t\tdata, err := io.ReadAll(os.Stdin)\n\t\tif err != nil {\n\t\t\treturn \"\", false, fmt.Errorf(\"read stdin for --content-stdin: %w\", err)\n\t\t}\n\t\treturn skillContentBytesToString(data, \"stdin content for --content-stdin\")\n\t}\n\tif filePath != \"\" {\n\t\tdata, err := os.ReadFile(filePath)\n\t\tif err != nil {\n\t\t\treturn \"\", false, fmt.Errorf(\"read file for --content-file: %w\", err)\n\t\t}\n\t\treturn skillContentBytesToString(data, \"file content for --content-file\")\n\t}\n\tif inlineSet {\n\t\treturn inline, true, nil\n\t}\n\treturn \"\", false, nil\n}\n\nfunc skillContentBytesToString(data []byte, label string) (string, bool, error) {\n\tif len(data) == 0 {\n\t\treturn \"\", false, fmt.Errorf(\"%s is empty\", label)\n\t}\n\tif !utf8.Valid(data) {\n\t\treturn \"\", false, fmt.Errorf(\"%s must be valid UTF-8\", label)\n\t}\n\treturn string(data), true, nil\n}","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_skill.go#L193-L229","documentation":"Returned when --content-file is used and os.ReadFile fails: the path does not exist, is a directory, or permission is denied. The %w wraps the *PathError including the offending path. It fires before any content validation (empty/UTF-8) or API call.","triggerScenarios":"`multica skill create --content-file ./missing.md`, pointing --content-file at a directory, or referencing a file the current user cannot read.","commonSituations":"Relative path resolved against an unexpected working directory; typos; files generated by a previous pipeline step that silently failed; permissions changed after staging the file.","solutions":["Check the path in the wrapped error and verify it exists: `ls -l <path>`.","Use an absolute path to avoid working-directory ambiguity in scripts.","Fix read permissions if denied.","Confirm the file was actually produced before the multica command in your pipeline."],"exampleFix":"# before\nmultica skill create --name s --content-file skill.md   # run from another cwd\n# after\nmultica skill create --name s --content-file \"$(pwd)/skills/skill.md\"","handlingStrategy":"validation","validationCode":"# Resolve and verify before invoking multica\nf=\"$(realpath -e \"$CONTENT_FILE\")\" || { echo \"no such file: $CONTENT_FILE\"; exit 2; }\n[ -f \"$f\" ] && [ -r \"$f\" ] || { echo \"not a readable file: $f\"; exit 2; }","typeGuard":null,"tryCatchPattern":"Match 'read file for --content-file' in stderr; the wrapped *PathError names the path — fix existence/permissions, then retry once.","preventionTips":["Use absolute paths in scripts.","Stage and verify generated files (`test -s`) before referencing them.","Check `ls -ld` on the parent dir when permission errors appear."],"tags":["go","cli","filesystem","validation","skills"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}