{"record":{"id":"a155928ada461182","repo":"multica-ai/multica","slug":"content-is-required","errorCode":null,"errorMessage":"--content is required","messagePattern":"--content is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"server/cmd/multica/cmd_skill.go","lineNumber":687,"sourceCode":"\treturn nil\n}\n\nfunc runSkillFilesUpsert(cmd *cobra.Command, args []string) error {\n\tclient, err := newAPIClient(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfilePath, _ := cmd.Flags().GetString(\"path\")\n\tif filePath == \"\" {\n\t\treturn fmt.Errorf(\"--path is required\")\n\t}\n\tcontent, hasContent, err := resolveSkillContentFlag(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !hasContent || content == \"\" {\n\t\treturn fmt.Errorf(\"--content is required\")\n\t}\n\n\tbody := map[string]any{\n\t\t\"path\":    filePath,\n\t\t\"content\": content,\n\t}\n\n\tctx, cancel := cli.APIContext(context.Background())\n\tdefer cancel()\n\n\tvar result map[string]any\n\tif err := client.PutJSON(ctx, \"/api/skills/\"+args[0]+\"/files\", body, &result); err != nil {\n\t\treturn fmt.Errorf(\"upsert skill file: %w\", err)\n\t}\n\n\toutput, _ := cmd.Flags().GetString(\"output\")\n\tif output == \"json\" {\n\t\treturn cli.PrintJSON(os.Stdout, result)","sourceCodeStart":669,"sourceCodeEnd":705,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_skill.go#L669-L705","documentation":"Client-side validation in `multica skill files upsert`: content resolution via resolveSkillContentFlag produced nothing — neither --content nor whatever alternate source that helper supports (e.g. --content-file/stdin) yielded non-empty text. The check requires both hasContent (a source was given) and non-empty text, so this fires for a missing flag, an empty string, or an empty auxiliary file/stdin.","triggerScenarios":"Omitting --content entirely; passing `--content \"\"`; piping empty stdin (`multica skill files upsert ... < /dev/null`) when the helper reads stdin; --content-file pointing at an empty file.","commonSituations":"Script pipes a generator whose output was empty (grep found nothing upstream); heredoc with a typo producing zero lines; user expects the command to open an editor.","solutions":["Provide the text explicitly: `--content \"...\"` or a non-empty file/stdin source per the command's --help.","If generating content in a pipeline, verify it first: `test -s /tmp/content.txt && multica skill files upsert ...`.","Check `multica skill files upsert --help` for all accepted content-source flags so you use the intended one."],"exampleFix":"# before\ncat empty.txt | multica skill files upsert sk-1 --path SKILL.md\n\n# after\nprintf '# My skill\\n' > content.md\ntest -s content.md && multica skill files upsert sk-1 --path SKILL.md --content \"$(cat content.md)\"","handlingStrategy":"validation","validationCode":"test -s \"$CONTENT_FILE\" || { echo \"content file empty or missing: $CONTENT_FILE\"; exit 1; }\nmultica skill files upsert \"$SKILL_ID\" --path p.md --content \"$(cat \"$CONTENT_FILE\")\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Generate content to a file and check it is non-empty (test -s) before upserting.","When piping into the CLI, ensure the upstream generator cannot emit zero bytes silently.","Check --help for every accepted content source flag rather than guessing."],"tags":["cli","validation","flags","content","skill"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}