{"record":{"id":"28e97ff434fe8258","repo":"stablyai/orca","slug":"invalid-orca-profile-project-transfer","errorCode":null,"errorMessage":"invalid_orca_profile_project_transfer","messagePattern":"invalid_orca_profile_project_transfer","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/main/ipc/orca-profiles.ts","lineNumber":72,"sourceCode":"\nfunction profileIdFromArgs(args: unknown): string {\n  if (\n    !args ||\n    typeof args !== 'object' ||\n    typeof (args as SwitchOrcaProfileArgs).profileId !== 'string'\n  ) {\n    throw new Error('invalid_orca_profile_id')\n  }\n  const profileId = (args as SwitchOrcaProfileArgs).profileId.trim()\n  if (!profileId) {\n    throw new Error('invalid_orca_profile_id')\n  }\n  return profileId\n}\n\nfunction transferProjectArgsFromUnknown(args: unknown): TransferOrcaProfileProjectArgs {\n  if (!args || typeof args !== 'object') {\n    throw new Error('invalid_orca_profile_project_transfer')\n  }\n  const candidate = args as TransferOrcaProfileProjectArgs\n  const sourceProfileId = candidate.sourceProfileId?.trim()\n  const targetProfileId = candidate.targetProfileId?.trim()\n  const repoId = candidate.repoId?.trim()\n  const mode = candidate.mode\n  if (!sourceProfileId || !targetProfileId || !repoId || (mode !== 'move' && mode !== 'copy')) {\n    throw new Error('invalid_orca_profile_project_transfer')\n  }\n  return {\n    sourceProfileId,\n    targetProfileId,\n    repoId,\n    mode\n  }\n}\n\nfunction findProjectsByPathArgsFromUnknown(args: unknown): FindOrcaProfileProjectsByPathArgs {","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/ipc/orca-profiles.ts#L54-L90","documentation":"Thrown by transferProjectArgsFromUnknown() (line 72) when the payload for orcaProfiles:transferProject is not an object at all. This is the shape branch; the content-validation branch is line 80. It runs before the active-target / source-active checks and before any filesystem transfer, so a malformed envelope never reaches transferOrcaProfileProject.","triggerScenarios":"Invoking orcaProfiles:transferProject with undefined, null, a primitive, or an array as the sole argument.","commonSituations":"The renderer dispatched the transfer action with no payload (e.g. a button onClick with no args bound), or a refactor wrapped the args inside another object so the outer value is { payload: {...} } rather than the args themselves.","solutions":["Pass the args object directly as the second IPC argument: { sourceProfileId, targetProfileId, repoId, mode }.","Construct the payload at the call site from validated profile and repo ids, not from a possibly-undefined outer wrapper.","If the source/target profile pickers are not both populated, disable the transfer button.","Do not wrap the envelope — main reads the args object at the top level."],"exampleFix":"// before\nawait ipcRenderer.invoke('orcaProfiles:transferProject', { payload: transferForm })\n\n// after\nawait ipcRenderer.invoke('orcaProfiles:transferProject', {\n  sourceProfileId: transferForm.sourceProfileId,\n  targetProfileId: transferForm.targetProfileId,\n  repoId: transferForm.repoId,\n  mode: transferForm.mode\n})","handlingStrategy":"validation","validationCode":"function isTransferEnvelope(v: unknown): v is object {\n  return typeof v === 'object' && v !== null && !Array.isArray(v)\n}\n\nif (!isTransferEnvelope(payload)) {\n  setTransferError('Missing transfer details.')\n  return\n}","typeGuard":"function isPlainObject(v: unknown): v is Record<string, unknown> {\n  return typeof v === 'object' && v !== null && !Array.isArray(v)\n}","tryCatchPattern":"try {\n  await ipcRenderer.invoke('orcaProfiles:transferProject', payload)\n} catch (e) {\n  if (e instanceof Error && e.message === 'invalid_orca_profile_project_transfer') {\n    setTransferError('Provide source, target, repo, and mode.')\n  } else throw e\n}","preventionTips":["Construct the transfer payload as a flat object at the call site.","Do not wrap args inside { payload } — main reads the top level.","Type the call against TransferOrcaProfileProjectArgs."],"tags":["ipc","validation","orca-profiles","argument-validation"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}