multica-ai/multica · error

%s is empty

Error message

%s is empty

What it means

Content validation from skillContentBytesToString: the resolved content (stdin or file bytes) is zero-length. The label in the formatted message tells you which source ('stdin content for --content-stdin' or 'file content for --content-file'). Empty inline --content is not caught here (inlineSet returns the string directly), so this specifically guards byte sources.

Source

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

		}
		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
}

func runSkillList(cmd *cobra.Command, _ []string) error {
	client, err := newAPIClient(cmd)
	if err != nil {
		return err
	}

	ctx, cancel := cli.APIContext(context.Background())
	defer cancel()

	var skills []map[string]any
	if err := client.GetJSON(ctx, "/api/skills", &skills); err != nil {

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Verify the source actually has bytes: `wc -c < file` or test the pipe output before running multica.
  2. Fix the upstream step that was supposed to generate the content.
  3. If the skill genuinely has no content, omit the content flags entirely (create returns hasContent=false and the field is simply not sent).

Example fix

# before
: > /tmp/skill.md && multica skill create --name s --content-file /tmp/skill.md
# after
test -s /tmp/skill.md && multica skill create --name s --content-file /tmp/skill.md
Defensive patterns

Strategy: validation

Validate before calling

# Guard both sources before the CLI runs
[ -n "$CONTENT_FILE" ] && { test -s "$CONTENT_FILE" || { echo "content file is empty"; exit 2; }; }
# for pipes: bytes=$(cat); [ -n "$bytes" ] || exit 2

Try / catch

Match 'is empty' with the source label; if the producer was supposed to emit content, fix upstream and retry — do not substitute placeholder content.

Prevention

When it happens

Trigger: `multica skill create --content-stdin < /dev/null`, piping an empty string (echo -n | ...), or passing --content-file pointing at an empty (0-byte) file.

Common situations: Upstream generator produced no output but exited 0; redirecting from an empty placeholder file; scripting with `--content-stdin` where the heredoc collapsed.

Related errors


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