multica-ai/multica · error
read file for --%s: %w
Error message
read file for --%s: %w
What it means
Returned by the shared text-source helper when os.ReadFile fails for a --flag-file variant. The %s names the file flag and %w wraps the underlying path error (not found, permission denied, is-a-directory, etc.). Note the path must also pass ensureFileFlagWithinWorkdir first, so it is already constrained to the working directory.
Source
Thrown at server/cmd/multica/cmd_issue.go:78
if useStdin {
data, err := io.ReadAll(os.Stdin)
if err != nil {
return "", false, fmt.Errorf("read stdin for --%s: %w", stdinFlag, err)
}
body := strings.TrimSuffix(string(data), "\n")
if body == "" {
return "", false, fmt.Errorf("stdin content for --%s is empty", stdinFlag)
}
return body, true, nil
}
if filePath != "" {
if err := ensureFileFlagWithinWorkdir(cmd, fileFlag, flagName, filePath); err != nil {
return "", false, err
}
data, err := os.ReadFile(filePath)
if err != nil {
return "", false, fmt.Errorf("read file for --%s: %w", fileFlag, err)
}
body := strings.TrimSuffix(string(data), "\n")
if body == "" {
return "", false, fmt.Errorf("file content for --%s is empty", fileFlag)
}
return body, true, nil
}
if inline == "" {
return "", false, nil
}
return util.UnescapeBackslashEscapes(inline), true, nil
}
// ensureFileFlagWithinWorkdir fails closed when a --<name>-file path resolves
// outside the current working directory, unless --allow-external-file is set.
//
// Agent task workdirs are isolated per profile and per task; machine-shared
// scratch paths like /tmp are not. MUL-4252 traced a cross-environment contextView on GitHub (pinned to 2c0912b6ec)
Solutions
- Check the wrapped error for the OS cause; verify the path exists and is a readable regular file (ls -l, test -f && test -r)
- Use a path relative to the current working directory (the helper enforces workdir containment) or an absolute path inside it
- Fix permissions if reading fails with EACCES (chmod/chown or run as a user with read access)
- If the file is generated by an earlier step, verify that step succeeded before this command runs
Example fix
# before multica issue create --title "T" --description-file ./desc.txt # error: read file for --description-file: open ./desc.txt: no such file or directory # after ls -l ./desc.txt # confirm it exists and is readable multica issue create --title "T" --description-file ./desc.txt
Defensive patterns
Strategy: validation
Validate before calling
# bash: verify readability and workdir containment before --*-file
[[ -f "$DESC_FILE" && -r "$DESC_FILE" ]] || { echo "missing/unreadable: $DESC_FILE" >&2; exit 1; }
multica issue create --title "$t" --description-file "$DESC_FILE" Prevention
- Check file existence and permissions (test -f, test -r) before invoking file flags
- Remember the helper restricts file paths to the current working directory — run the CLI from the directory containing the file
When it happens
Trigger: Using --flag-file with a nonexistent path, an unreadable file (bad permissions), or a directory. The reachability-within-workdir check passed, so the path resolved legally but the OS read itself failed.
Common situations: Relative paths resolved from a different cwd than expected; files deleted between command construction and execution; permission mismatches when running under a different user or container; typos in the filename.
Related errors
- read --%s-file: %w
- read stdin for --%s: %w
- --cutoff is required; use the hosted deployment time of the
- --batch-size must be positive
- file not found: %w
AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15).
Data as JSON: /api/errors/6ea7c6684f2ef000.
Report an issue: GitHub.