{"record":{"id":"56d90b23ca4f4176","repo":"multica-ai/multica","slug":"creation-studio-create-failed","errorCode":null,"errorMessage":"creation_studio.create_failed","messagePattern":"creation_studio\\.create_failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/views/agents/create/use-create-agent-submit.ts","lineNumber":77,"sourceCode":"\n  const { draft, runtimeId, squadId, template, duplicateSource, onCreated } =\n    options;\n\n  const create = async () => {\n    if (!runtimeId || creating) return;\n    setCreating(true);\n    setNameError(null);\n    setFormError(null);\n    try {\n      const agent = await api.createAgent(\n        buildCreateAgentRequest({\n          draft,\n          runtimeId,\n          template,\n          duplicateSource,\n        }),\n      );\n      if (!agent.id) throw new Error(t(($) => $.creation_studio.create_failed));\n\n      if (squadId) {\n        try {\n          await api.addSquadMember(squadId, {\n            member_type: \"agent\",\n            member_id: agent.id,\n          });\n          await Promise.all([\n            qc.invalidateQueries({\n              queryKey: [...workspaceKeys.squads(wsId), squadId, \"members\"],\n            }),\n            qc.invalidateQueries({\n              queryKey: [...workspaceKeys.squads(wsId), squadId],\n            }),\n          ]);\n        } catch (error) {\n          toast.warning(\n            t(($) => $.create_dialog.squad_join_failed_toast, {","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/packages/views/agents/create/use-create-agent-submit.ts#L59-L95","documentation":"i18n message key (creation_studio.create_failed) thrown in use-create-agent-submit.ts when api.createAgent returned but the created agent record had no id. It marks the final agent-creation step of the creation studio as failed after the request completed with an unusable payload. Squad membership addition happens only after this guard, so it also implies no squad add was attempted.","triggerScenarios":"POST createAgent returns 2xx with a body missing the id field; server-side validation created a partial record but response serialization dropped id; version skew where the agent response schema changed.","commonSituations":"Server/client version mismatch after a schema migration; a proxy or interceptor stripping response fields; the draft payload built by buildCreateAgentRequest being accepted but the server returning an error envelope the client does not parse as a failure.","solutions":["Inspect the actual createAgent response in the network tab — verify whether the server returned an error envelope with HTTP 200.","Align frontend and server versions; a missing id on a successful status is almost always schema drift.","Check server logs for the create-agent handler to see whether the record was actually persisted.","Retry after fixing the underlying cause; the form state (draft, template, duplicateSource) is preserved so nothing is lost."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":"function isCreatedAgent(a: unknown): a is { id: string } {\n  return typeof a === \"object\" && a !== null && typeof (a as { id?: unknown }).id === \"string\" && (a as { id: string }).id.length > 0;\n}","tryCatchPattern":"try {\n  const agent = await api.createAgent(buildCreateAgentRequest({ draft, runtimeId, template, duplicateSource }));\n  if (!isCreatedAgent(agent)) throw new Error(t(($) => $.creation_studio.create_failed));\n  // squad membership add only after this guard\n} catch (err) {\n  setFormError(err instanceof Error ? err.message : t(($) => $.creation_studio.create_failed));\n}","preventionTips":["Pin frontend and server versions together in deploys; a missing id on success is schema drift.","Log the raw response body when this guard fires to capture the actual server envelope.","Keep form state (draft/template) around on failure so users can retry without re-entering."],"tags":["agents","creation-studio","i18n","api-contract","typescript"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}