stablyai/orca · error · Error
invalid_orca_profile_id
Error message
invalid_orca_profile_id
What it means
Thrown by profileIdFromArgs() in orca-profiles.ts (line 61) when the payload for orcaProfiles:switch is not an object, or its profileId field is not a string at all. This is the type-shape branch; the empty-string branch is a separate throw on line 65. The guard runs before any profile lookup, session mutation, or relaunch scheduling, so an invalid id never reaches setActiveOrcaProfile.
Source
Thrown at src/main/ipc/orca-profiles.ts:61
refreshCurrentOrcaProfileAuth,
selectCurrentOrcaProfileOrg,
signOutCurrentOrcaProfile
} from '../orca-profiles/profile-cloud-service'
import { registerOrcaProfileOrgMemberHandlers } from './orca-profile-org-members-handlers'
type RegisterOrcaProfileHandlersOptions = {
onBeforeRelaunch?: () => void | Promise<void>
onAuthMutation?: () => void
onBeforeSignOut?: () => void
}
function profileIdFromArgs(args: unknown): string {
if (
!args ||
typeof args !== 'object' ||
typeof (args as SwitchOrcaProfileArgs).profileId !== 'string'
) {
throw new Error('invalid_orca_profile_id')
}
const profileId = (args as SwitchOrcaProfileArgs).profileId.trim()
if (!profileId) {
throw new Error('invalid_orca_profile_id')
}
return profileId
}
function transferProjectArgsFromUnknown(args: unknown): TransferOrcaProfileProjectArgs {
if (!args || typeof args !== 'object') {
throw new Error('invalid_orca_profile_project_transfer')
}
const candidate = args as TransferOrcaProfileProjectArgs
const sourceProfileId = candidate.sourceProfileId?.trim()
const targetProfileId = candidate.targetProfileId?.trim()
const repoId = candidate.repoId?.trim()
const mode = candidate.mode
if (!sourceProfileId || !targetProfileId || !repoId || (mode !== 'move' && mode !== 'copy')) {View on GitHub (pinned to 1136503c6a)
Solutions
- Always pass an object with a string profileId, sourcing it from the list returned by orcaProfiles:list.
- If you only have a profile object, pass { profileId: profile.id }, not the object itself.
- Guard in the renderer: skip the call entirely when profileId is not a non-empty string.
- Keep the IPC payload key as 'profileId' — do not rename it without a coordinated main+renderer change.
Example fix
// before
await ipcRenderer.invoke('orcaProfiles:switch', selectedProfile)
// after
if (typeof selectedProfile?.id !== 'string' || !selectedProfile.id.trim()) return
await ipcRenderer.invoke('orcaProfiles:switch', { profileId: selectedProfile.id }) Defensive patterns
Strategy: type-guard
Validate before calling
function isSwitchArgs(v: unknown): v is { profileId: string } {
return (
typeof v === 'object' &&
v !== null &&
typeof (v as { profileId?: unknown }).profileId === 'string'
)
}
if (!isSwitchArgs(payload)) return Type guard
function isSwitchOrcaProfileArgs(v: unknown): v is { profileId: string } {
return (
!!v &&
typeof v === 'object' &&
typeof (v as { profileId?: unknown }).profileId === 'string'
)
} Try / catch
try {
await ipcRenderer.invoke('orcaProfiles:switch', { profileId })
} catch (e) {
if (e instanceof Error && e.message === 'invalid_orca_profile_id') {
setProfileError('Select a profile to switch to.')
} else throw e
} Prevention
- Pass { profileId: profile.id }, not the profile object.
- Keep the payload key as 'profileId'.
- Type the renderer call site against SwitchOrcaProfileArgs from shared/orca-profiles.
When it happens
Trigger: Invoking orcaProfiles:switch with undefined args, a primitive, or a payload whose profileId is null/number/object rather than a string.
Common situations: The renderer called switch with no argument, a profile object was passed instead of profile.id, or a refactor changed the payload key from profileId to id without updating the call sites.
Related errors
- invalid_orca_org_role
- invalid_orca_org_member_email
- invalid_orca_org_member_user
- invalid_orca_profile_project_transfer
- invalid_orca_profile_project_path
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/ca8e00f8f9e32999.
Report an issue: GitHub.