multica-ai/multica · error

read file for --content-file: %w

Error message

read file for --content-file: %w

What it means

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.

Source

Thrown at server/cmd/multica/cmd_skill.go:211

	}
	if filePath != "" {
		sources++
	}
	if sources > 1 {
		return "", false, fmt.Errorf("--content, --content-stdin, and --content-file are mutually exclusive")
	}

	if useStdin {
		data, err := io.ReadAll(os.Stdin)
		if err != nil {
			return "", false, fmt.Errorf("read stdin for --content-stdin: %w", err)
		}
		return skillContentBytesToString(data, "stdin content for --content-stdin")
	}
	if filePath != "" {
		data, err := os.ReadFile(filePath)
		if err != nil {
			return "", false, fmt.Errorf("read file for --content-file: %w", err)
		}
		return skillContentBytesToString(data, "file content for --content-file")
	}
	if inlineSet {
		return inline, true, nil
	}
	return "", false, nil
}

func skillContentBytesToString(data []byte, label string) (string, bool, error) {
	if len(data) == 0 {
		return "", false, fmt.Errorf("%s is empty", label)
	}
	if !utf8.Valid(data) {
		return "", false, fmt.Errorf("%s must be valid UTF-8", label)
	}
	return string(data), true, nil
}

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Check the path in the wrapped error and verify it exists: `ls -l <path>`.
  2. Use an absolute path to avoid working-directory ambiguity in scripts.
  3. Fix read permissions if denied.
  4. Confirm the file was actually produced before the multica command in your pipeline.

Example fix

# before
multica skill create --name s --content-file skill.md   # run from another cwd
# after
multica skill create --name s --content-file "$(pwd)/skills/skill.md"
Defensive patterns

Strategy: validation

Validate before calling

# Resolve and verify before invoking multica
f="$(realpath -e "$CONTENT_FILE")" || { echo "no such file: $CONTENT_FILE"; exit 2; }
[ -f "$f" ] && [ -r "$f" ] || { echo "not a readable file: $f"; exit 2; }

Try / catch

Match 'read file for --content-file' in stderr; the wrapped *PathError names the path — fix existence/permissions, then retry once.

Prevention

When it happens

Trigger: `multica skill create --content-file ./missing.md`, pointing --content-file at a directory, or referencing a file the current user cannot read.

Common situations: 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.

Related errors


AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15). Data as JSON: /api/errors/36fd0416364d3d6e. Report an issue: GitHub.