{"record":{"id":"56506561618de827","repo":"multica-ai/multica","slug":"set-agent-skills-w","errorCode":null,"errorMessage":"set agent skills: %w","messagePattern":"set agent skills: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_agent.go","lineNumber":1039,"sourceCode":"\tclient, err := newAPIClient(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !cmd.Flags().Changed(\"skill-ids\") {\n\t\treturn fmt.Errorf(\"--skill-ids is required (comma-separated skill IDs; use --skill-ids '' to clear all)\")\n\t}\n\tcleanIDs := cleanSkillIDsFlag(cmd)\n\tbody := map[string]any{\n\t\t\"skill_ids\": cleanIDs,\n\t}\n\n\tctx, cancel := cli.APIContext(context.Background())\n\tdefer cancel()\n\n\tvar result json.RawMessage\n\tif err := client.PutJSON(ctx, \"/api/agents/\"+args[0]+\"/skills\", body, &result); err != nil {\n\t\treturn fmt.Errorf(\"set agent skills: %w\", err)\n\t}\n\n\treturn printAgentSkillsMutationResult(cmd, args[0], result)\n}\n\nfunc runAgentSkillsAdd(cmd *cobra.Command, args []string) error {\n\tclient, err := newAPIClient(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !cmd.Flags().Changed(\"skill-ids\") {\n\t\treturn fmt.Errorf(\"--skill-ids is required (comma-separated skill IDs)\")\n\t}\n\tcleanIDs := cleanSkillIDsFlag(cmd)\n\tif len(cleanIDs) == 0 {\n\t\treturn fmt.Errorf(\"--skill-ids must include at least one skill ID\")\n\t}","sourceCodeStart":1021,"sourceCodeEnd":1057,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_agent.go#L1021-L1057","documentation":"Wrapped error returned when `multica agent skills set <id>` fails to PUT {\"skill_ids\": [...]} to `/api/agents/{id}/skills`. The server validates ids and state; the wrapped cause is typically 404 (agent or one of the skill ids unknown), 401/403 (auth), or a connection failure. Because this is a full replacement, the server rejects the whole batch if any id is invalid.","triggerScenarios":"Including a deleted or mistyped skill id in the comma list, targeting a nonexistent agent, expired token, or server unreachable.","commonSituations":"Skill ids copied from another workspace or after skills were re-created with new ids; trailing whitespace is trimmed by cleanSkillIDsFlag but case-mangled or truncated ids are not; stale tokens in CI jobs.","solutions":["List valid skills (`multica skill list` or equivalent) and verify every id before setting","Confirm the agent id via `multica agent list`","Fix connectivity/auth if the wrapped error is connection or 401/403 class","Re-run with only confirmed-existing skill ids"],"exampleFix":"# before\nmultica agent skills set agt_1 --skill-ids sk_old,sk_typo\n# Error: set agent skills: 400: unknown skill id sk_typo\n\n# after\nmultica skill list\nmultica agent skills set agt_1 --skill-ids sk_new,sk_valid","handlingStrategy":"try-catch","validationCode":"multica skill list --output json | jq -e --arg id \"$SKILL_ID\" '.[] | select(.id == $id)' >/dev/null || { echo 'unknown skill id'; exit 1; }\nmultica agent skills set \"$AGENT_ID\" --skill-ids \"$SKILL_IDS\"","typeGuard":null,"tryCatchPattern":"if err := client.PutJSON(ctx, \"/api/agents/\"+args[0]+\"/skills\", body, &result); err != nil {\n\treturn fmt.Errorf(\"set agent skills: %w\", err) // 400 names the offending skill id\n}","preventionTips":["Verify every skill id against the skill list before setting","Remember set replaces the whole list — validate all ids, not just new ones","Refresh id lists after skills are recreated"],"tags":["cli","api","skills","validation"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}