{"record":{"id":"f1057114a092f093","repo":"moeru-ai/airi","slug":"invalid-godot-stage-scene-input-payload","errorCode":null,"errorMessage":"Invalid Godot stage scene input payload.","messagePattern":"Invalid Godot stage scene input payload\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/stage-tamagotchi/src/main/services/airi/godot-stage/index.ts","lineNumber":230,"sourceCode":"  if (!result.success)\n    throw new Error('Invalid Godot stage WebSocket envelope.')\n\n  return result.output\n}\n\nfunction getPayloadMessage(payload: unknown) {\n  const result = safeParse(godotStagePayloadMessageSchema, payload)\n  if (!result.success) {\n    return undefined\n  }\n\n  return result.output.message\n}\n\nfunction parseSceneInputPayload(payload: unknown): ElectronGodotStageSceneInputPayload {\n  const result = safeParse(godotStageSceneInputPayloadSchema, payload)\n  if (!result.success)\n    throw new Error('Invalid Godot stage scene input payload.')\n\n  return result.output\n}\n\nfunction resolveGodotStageStorageRoot() {\n  return join(app.getPath('userData'), 'godot-stage')\n}\n\nfunction resolveGodotStageDebugLaunchOptions() {\n  const remoteDebugEnabled = ['1', 'true', 'yes', 'on'].includes(\n    (process.env.GODOT_STAGE_REMOTE_DEBUG ?? '').trim().toLowerCase(),\n  )\n  const remoteDebugUri = remoteDebugEnabled\n    ? process.env.GODOT_STAGE_REMOTE_DEBUG_URI?.trim() || DEFAULT_GODOT_REMOTE_DEBUG_URI\n    : undefined\n\n  // Godot engine/debugger flags must stay before `--`; StageRoot arguments stay\n  // after it and are assembled next to the WebSocket URL.","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/moeru-ai/airi/blob/27111382b4a79a7e983289d6e983a06af185ed0f/apps/stage-tamagotchi/src/main/services/airi/godot-stage/index.ts#L212-L248","documentation":"Thrown by parseSceneInputPayload when valibot's safeParse against godotStageSceneInputPayloadSchema fails. The schema validates the shape of a scene-input payload (fileName, modelId, data, etc.) forwarded to the Godot stage. safeParse returns { success: false } for any structural/type violation, so the throw is purely a validation failure on the inbound IPC payload.","triggerScenarios":"Calling electronGodotStageApplySceneInput with a payload missing required fields, with wrong-typed fields (e.g. data not a Uint8Array/Buffer-compatible value, fileName not a string), or with extra fields that the schema rejects.","commonSituations":"Renderer/IPC caller constructed the payload by hand and omitted a required field; schema was tightened in a shared package but the caller wasn't updated; deserialization (IPC) coerced a Buffer into a plain object; modelId empty or fileName containing path traversal characters that the schema forbids.","solutions":["Compare the payload object against godotStageSceneInputPayloadSchema (in @proj-airi/stage-shared/godot-stage) and supply every required field with the correct type.","Validate on the caller side with the same schema before invoking applySceneInput so the error surfaces at the source.","Ensure binary data is sent as a Uint8Array/Buffer that survives IPC serialization.","If the schema changed, rebuild and re-check both renderer and main against the latest shared package."],"exampleFix":"// before\nawait electronGodotStageApplySceneInput({ fileName: 'model.vrm' }) // missing modelId/data\n\n// after\nawait electronGodotStageApplySceneInput({\n  modelId: 'abc-123',\n  fileName: 'model.vrm',\n  data: new Uint8Array(fileBytes),\n})","handlingStrategy":"validation","validationCode":"import { safeParse, godotStageSceneInputPayloadSchema } from '@proj-airi/stage-shared/godot-stage'\n\nconst result = safeParse(godotStageSceneInputPayloadSchema, payload)\nif (!result.success) {\n  // surface result.issues to the caller; do not invoke applySceneInput\n}","typeGuard":"import { safeParse, godotStageSceneInputPayloadSchema } from '@proj-airi/stage-shared/godot-stage'\n\nfunction isValidSceneInputPayload(payload: unknown): boolean {\n  return safeParse(godotStageSceneInputPayloadSchema, payload).success\n}","tryCatchPattern":null,"preventionTips":["Validate payloads with the shared schema at the call site before IPC.","Keep renderer and main on the same version of the shared schema package.","Send binary data as Uint8Array so it survives IPC serialization."],"tags":["godot-stage","validation","valibot","ipc","electron","schema"],"backgroundTag":null,"analyzedSha":"27111382b4a79a7e983289d6e983a06af185ed0f","analyzedAt":"2026-08-12T18:33:34.132Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}