{"record":{"id":"3edc1a34c290d5a2","repo":"multica-ai/multica","slug":"read-s-file-w","errorCode":null,"errorMessage":"read --%s-file: %w","messagePattern":"read --(.+?)-file: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_agent.go","lineNumber":1417,"sourceCode":"\t\traw, _ = cmd.Flags().GetString(prefix)\n\tcase fromStdin:\n\t\tbuf, err := io.ReadAll(cmd.InOrStdin())\n\t\tif err != nil {\n\t\t\treturn nil, false, fmt.Errorf(\"read --%s-stdin: %w\", prefix, err)\n\t\t}\n\t\traw = string(buf)\n\t\tif strings.TrimSpace(raw) == \"\" {\n\t\t\treturn nil, false, fmt.Errorf(\"--%s-stdin: empty input%s\", prefix, clearHint)\n\t\t}\n\tcase fromFile:\n\t\tif filePath == \"\" {\n\t\t\treturn nil, false, fmt.Errorf(\"--%s-file: path must not be empty\", prefix)\n\t\t}\n\t\tbuf, err := os.ReadFile(filePath)\n\t\tif err != nil {\n\t\t\t// Filesystem errors may include the path but not the contents —\n\t\t\t// safe to surface via %w.\n\t\t\treturn nil, false, fmt.Errorf(\"read --%s-file: %w\", prefix, err)\n\t\t}\n\t\traw = string(buf)\n\t\tif strings.TrimSpace(raw) == \"\" {\n\t\t\treturn nil, false, fmt.Errorf(\"--%s-file %q: empty contents%s\", prefix, filePath, clearHint)\n\t\t}\n\t}\n\n\tmc, err := parseMcpJSONObject(\"--\"+prefix, raw, allowNull)\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\treturn mc, true, nil\n}\n\nfunc strVal(m map[string]any, key string) string {\n\tv, ok := m[key]\n\tif !ok || v == nil {\n\t\treturn \"\"","sourceCodeStart":1399,"sourceCodeEnd":1435,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_agent.go#L1399-L1435","documentation":"Thrown when os.ReadFile fails for the path given to --<prefix>-file. The filesystem error is wrapped with %w, so the message includes the underlying cause: file does not exist, permission denied, or a path component is not a directory. The CLI's comment notes filesystem errors contain the path but not the contents, so surfacing them is safe.","triggerScenarios":"`multica agent update <id> --mcp-config-file ./missing.json` (ENOENT); a file with mode 600 owned by another user (EACCES); a path like /etc/passwd/dir where a component is a file (ENOTDIR).","commonSituations":"Running the CLI from a different working directory than assumed with relative paths; deploying to an environment where the config file was not mounted into the container; typos in the path; file permissions differing between dev and prod users.","solutions":["Verify the path exists and is readable: ls -l <path>, and that you are in the expected working directory","Use an absolute path for the file flag to remove cwd ambiguity","Fix permissions (chmod/chown) if the error is permission denied","If the file was never created, write the config first or pass it inline via --<prefix>"],"exampleFix":"# before\nmultica agent update <id> --mcp-config-file cfg/mcp.json   # run from wrong cwd\n# after\nmultica agent update <id> --mcp-config-file \"$(pwd)/cfg/mcp.json\"","handlingStrategy":"validation","validationCode":"test -r \"$CFG_FILE\" || { echo \"missing or unreadable: $CFG_FILE\" >&2; exit 1; }\nmultica agent update <id> --mcp-config-file \"$CFG_FILE\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always use absolute paths for file flags in scripts and CI","Pre-flight check readability (test -r) before invoking the CLI","In containers, verify the config file is actually mounted in the entrypoint"],"tags":["cli","filesystem","io","go"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}