{"record":{"id":"5e6a040e6f6c7792","repo":"multica-ai/multica","slug":"file-is-required","errorCode":null,"errorMessage":"--file is required","messagePattern":"--file is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"server/cmd/multica/cmd_agent.go","lineNumber":912,"sourceCode":"\t\t\tstrVal(t, \"id\"),\n\t\t\tstrVal(t, \"issue_id\"),\n\t\t\tstrVal(t, \"status\"),\n\t\t\tstrVal(t, \"created_at\"),\n\t\t})\n\t}\n\tcli.PrintTable(os.Stdout, headers, rows)\n\treturn nil\n}\n\nfunc runAgentAvatar(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(\"file\")\n\tif filePath == \"\" {\n\t\treturn fmt.Errorf(\"--file is required\")\n\t}\n\n\t// Validate file exists.\n\tinfo, err := os.Stat(filePath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"file not found: %w\", err)\n\t}\n\n\t// Validate extension.\n\text := strings.ToLower(filepath.Ext(filePath))\n\tvalidExts := map[string]bool{\".png\": true, \".jpg\": true, \".jpeg\": true, \".gif\": true, \".webp\": true}\n\tif !validExts[ext] {\n\t\treturn fmt.Errorf(\"unsupported file format %q: must be .png, .jpg, .jpeg, .gif, or .webp\", ext)\n\t}\n\n\t// Client-side size guard: reject files > 5MB.\n\tconst maxSize = 5 << 20 // 5 MB\n\tif info.Size() > maxSize {","sourceCodeStart":894,"sourceCodeEnd":930,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_agent.go#L894-L930","documentation":"Returned by `multica agent avatar <id>` when the --file flag is empty — either not passed at all or passed as an empty string. It is a pure client-side usage check that fires before any filesystem or API access.","triggerScenarios":"Running `multica agent avatar agt_1` without `--file path.png`, or `--file \"\"` from a script variable that is unset/empty.","commonSituations":"Scripted uploads where the file path variable failed to populate (empty env var, wrong argparse key), or forgetting the flag syntax in manual use.","solutions":["Pass the flag explicitly: `multica agent avatar <id> --file ./avatar.png`","In scripts, assert the variable is non-empty before invoking the command","Use `multica agent avatar --help` to confirm flag spelling"],"exampleFix":"# before\nmultica agent avatar agt_1\n# Error: --file is required\n\n# after\nmultica agent avatar agt_1 --file ./avatar.png","handlingStrategy":"validation","validationCode":"[ -n \"$AVATAR_FILE\" ] || { echo '--file is required'; exit 1; }\nmultica agent avatar \"$AGENT_ID\" --file \"$AVATAR_FILE\"","typeGuard":null,"tryCatchPattern":"filePath, _ := cmd.Flags().GetString(\"file\")\nif filePath == \"\" {\n\treturn fmt.Errorf(\"--file is required\")\n}","preventionTips":["Assert the path variable is non-empty before composing the command","Use named variables for flags in scripts to avoid silent omissions"],"tags":["cli","usage","validation","avatar"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}