stablyai/orca · error · RuntimeClientError

invalid_argument

invalid_argument

Error message

--kind must be git or folder

What it means

Thrown by getOptionalRepoKind in project.ts (line 36) when --kind is provided with a value other than 'git' or 'folder', the two RepoKind variants (shared/types.ts:93). The flag is optional across project setup-existing-folder, setup-create, and setup-update; when present it must match exactly or the call is rejected before the projectHostSetup RPC.

Source

Thrown at src/cli/handlers/project.ts:36

  formatProjectHostSetupList,
  formatProjectHostSetupResult,
  formatProjectHostSetupUpdateResult,
  formatProjectList,
  printResult
} from '../format'
import { getOptionalStringFlag, getRequiredStringFlag } from '../flags'
import { resolveRepoPathArgument } from '../repo-path-arguments'
import { RuntimeClientError } from '../runtime-client'

function getOptionalRepoKind(flags: Map<string, string | boolean>): RepoKind | undefined {
  const kind = getOptionalStringFlag(flags, 'kind')
  if (kind === undefined) {
    return undefined
  }
  if (kind === 'git' || kind === 'folder') {
    return kind
  }
  throw new RuntimeClientError('invalid_argument', '--kind must be git or folder')
}

export const PROJECT_HANDLERS: Record<string, CommandHandler> = {
  'project list': async ({ client, json }) => {
    const result = await client.call<{ projects: Project[] }>('project.list')
    printResult(result, json, formatProjectList)
  },
  'project setups': async ({ flags, client, json }) => {
    const projectFilter = getOptionalStringFlag(flags, 'project')
    const hostFilter = getOptionalStringFlag(flags, 'host')
    const result = await client.call<{ setups: ProjectHostSetup[] }>('projectHostSetup.list')
    const setups = result.result.setups.filter(
      (setup) =>
        (projectFilter === undefined || setup.projectId === projectFilter) &&
        (hostFilter === undefined || setup.hostId === hostFilter)
    )
    printResult({ ...result, result: { setups } }, json, formatProjectHostSetupList)
  },

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Use exactly 'git' or 'folder' (lowercase).
  2. Omit --kind to let the runtime infer it from the path/setup method.
  3. For worktree-based setups use '--kind git' with the appropriate worktree flags.

Example fix

// before
orca project setup-create --project p1 --host h1 --kind worktree
// after
orca project setup-create --project p1 --host h1 --kind git
Defensive patterns

Strategy: validation

Validate before calling

const KINDS = ['git', 'folder'] as const
function assertRepoKind(v: string | undefined) {
  if (v !== undefined && !KINDS.includes(v as never)) {
    throw new Error('--kind must be git or folder')
  }
}

Type guard

function isRepoKind(v: unknown): v is 'git' | 'folder' {
  return v === 'git' || v === 'folder'
}

Try / catch

try {
  await runProjectSetup(args)
} catch (err) {
  if (err instanceof RuntimeClientError && /kind must be/i.test(err.message)) {
    // use 'git' or 'folder', or omit --kind to infer, then retry
  } else { throw err }
}

Prevention

When it happens

Trigger: Calling 'project setup-create --kind <bad> ...' e.g. '--kind svn', '--kind worktree', '--kind Git' (case-sensitive), '--kind repo'. The branch at project.ts:35 fires.

Common situations: Assuming 'worktree' is a kind (worktrees are a git setup concern, not a separate kind); case mismatch; copy-pasting a value from a different tool's concept of project type.

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/dbed325f6c73bfb2. Report an issue: GitHub.