{"record":{"id":"2166d9ac8998ea96","repo":"multica-ai/multica","slug":"import-skill-w","errorCode":null,"errorMessage":"import skill: %w","messagePattern":"import skill: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_skill.go","lineNumber":482,"sourceCode":"\tonConflict, _ := cmd.Flags().GetString(\"on-conflict\")\n\tif !validSkillImportConflictStrategy(onConflict) {\n\t\treturn fmt.Errorf(\"--on-conflict must be one of: fail, overwrite, rename, skip\")\n\t}\n\n\tctx, cancel := context.WithTimeout(context.Background(), cli.AtLeastAPITimeout(60*time.Second))\n\tdefer cancel()\n\n\tvar result map[string]any\n\tif importFile != \"\" {\n\t\tfileData, readErr := os.ReadFile(importFile)\n\t\tif readErr != nil {\n\t\t\treturn fmt.Errorf(\"read skill archive: %w\", readErr)\n\t\t}\n\t\tif err := client.ImportSkillFile(ctx, fileData, filepath.Base(importFile), onConflict, &result); err != nil {\n\t\t\tif handledErr := handleSkillImportError(cmd, err); handledErr != nil {\n\t\t\t\treturn handledErr\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"import skill: %w\", err)\n\t\t}\n\t\treturn printSkillImportResult(cmd, result)\n\t}\n\n\tbody := map[string]any{\n\t\t\"url\":         importURL,\n\t\t\"on_conflict\": onConflict,\n\t}\n\tif err := client.PostJSON(ctx, \"/api/skills/import\", body, &result); err != nil {\n\t\tif handledErr := handleSkillImportError(cmd, err); handledErr != nil {\n\t\t\treturn handledErr\n\t\t}\n\t\treturn fmt.Errorf(\"import skill: %w\", err)\n\t}\n\n\treturn printSkillImportResult(cmd, result)\n}\n","sourceCodeStart":464,"sourceCodeEnd":500,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_skill.go#L464-L500","documentation":"Returned by the `--file` branch of `multica skill import`: the archive was read from disk successfully, but the multipart upload via `client.ImportSkillFile` to `/api/skills/import` failed. Before this generic wrap, `handleSkillImportError` inspects the error for a name-conflict (409) to produce a friendlier message — reaching this line means the failure was NOT a simple conflict: it is a transport error, timeout (60s budget), invalid archive, or a 4xx/5xx from the server.","triggerScenarios":"Server unreachable or auth failure; archive is not a valid skill bundle (missing SKILL.md, bad structure) so the server rejects it with 400; upload exceeding the 60s context deadline on slow links or large bundles; server 500 while persisting files.","commonSituations":"Hand-zipped bundle with wrong top-level layout; local dev server restarted mid-upload; bundle built with a newer format than the running server understands (version skew between CLI and server); network proxy stripping multipart bodies.","solutions":["Re-check server reachability/auth with `multica skill list` from the same environment.","Validate the archive structure: it must contain the expected skill bundle layout (SKILL.md at the expected level) — rebuild it with the same tool that produced working imports.","If a timeout, retry on a stable connection or import from `--url` instead to let the server fetch directly.","If the server returned 400/500, check server logs for the concrete validation failure — the CLI message only wraps the status."],"exampleFix":"# before\nmultica skill import --file bundle.zip --on-conflict fail  # 400 invalid bundle\n\n# after\nunzip -l bundle.zip          # confirm expected skill files at top level\nmultica skill import --file fixed-bundle.zip --on-conflict fail","handlingStrategy":"try-catch","validationCode":"# pre-flight: server reachable, archive looks like a zip with expected layout\nmultica skill list > /dev/null || exit 1\ncommand -v unzip >/dev/null && unzip -l \"$ARCHIVE\" | grep -q SKILL.md || echo 'warning: SKILL.md not visible in archive'","typeGuard":null,"tryCatchPattern":"Branch on the wrapped cause: conflict-shaped errors are already handled by handleSkillImportError, so what remains is transport (fix env), 400 invalid-bundle (fix archive layout), or timeout (retry / switch to --url). Log server-side details when the status is 4xx/5xx since the CLI message is generic.","preventionTips":["Build archives with the same packaging step that produced known-good imports.","Keep CLI and server versions in sync — bundle format evolves with the server.","For large bundles or flaky links, import via --url so the server fetches directly."],"tags":["cli","http","import","upload","skill"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}