{"record":{"id":"159b0345f787f908","repo":"cli/cli","slug":"there-are-no-available-machine-types-for-this-repo","errorCode":null,"errorMessage":"there are no available machine types for this repository","messagePattern":"there are no available machine types for this repository","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cmd/codespace/create.go","lineNumber":291,"sourceCode":"\n\t\tif devContainerPath == DEVCONTAINER_PROMPT_DEFAULT {\n\t\t\t// special arg allows users to opt out of devcontainer.json selection\n\t\t\tdevContainerPath = \"\"\n\t\t}\n\t}\n\n\tmachine := opts.machine\n\t// skip this if we have useWeb and no machine name provided,\n\t// because web UI will select default machine type if none is provided\n\t// web UI also provide a way to select machine type\n\t// therefore we let the user choose from the web UI instead of prompting from CLI\n\tif !(opts.useWeb && opts.machine == \"\") {\n\t\tmachine, err = getMachineName(ctx, a.apiClient, prompter, repository.ID, opts.machine, branch, userInputs.Location, devContainerPath)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error getting machine type: %w\", err)\n\t\t}\n\t\tif machine == \"\" {\n\t\t\treturn errors.New(\"there are no available machine types for this repository\")\n\t\t}\n\t}\n\n\tif len(opts.displayName) > displayNameMaxLength {\n\t\treturn fmt.Errorf(\"error creating codespace: display name should contain a maximum of %d characters\", displayNameMaxLength)\n\t}\n\n\tcreateParams := &api.CreateCodespaceParams{\n\t\tRepositoryID:           repository.ID,\n\t\tBranch:                 branch,\n\t\tMachine:                machine,\n\t\tLocation:               userInputs.Location,\n\t\tVSCSTarget:             vscsTarget,\n\t\tVSCSTargetURL:          vscsTargetUrl,\n\t\tIdleTimeoutMinutes:     int(opts.idleTimeout.Minutes()),\n\t\tRetentionPeriodMinutes: opts.retentionPeriod.Minutes(),\n\t\tDevContainerPath:       devContainerPath,\n\t\tPermissionsOptOut:      opts.permissionsOptOut,","sourceCodeStart":273,"sourceCodeEnd":309,"githubUrl":"https://github.com/cli/cli/blob/0eeec0b92edbe70199f9768522f831d3534f41ad/pkg/cmd/codespace/create.go#L273-L309","documentation":"This inline error in pkg/cmd/codespace/create.go is returned after getMachineName resolves to an empty string while creating a codespace. getMachineName prompts or matches the machine types returned by the API for the repository; an empty result means the API offered no machine types for this repository/branch/location/devcontainer combination. The check is skipped only when --web is used without an explicit --machine, because the web UI performs its own selection.","triggerScenarios":"Running gh codespace create for a repository where GetCodespacesMachines returns an empty list: commonly the repo is not codespace-enabled, the branch lacks a devcontainer the API can size, the chosen --location has no available capacity, or org policy/limits block machine allocation.","commonSituations":"Repository without a devcontainer.json or a .devcontainer that fails evaluation; organization disabled codespaces or set machine access to 'none'; region capacity issues; private repo where the user's plan grants no machine types; billing/spending limit exhausted.","solutions":["Add a valid .devcontainer/devcontainer.json to the repo and target a branch that contains it.","Check org/user settings: Settings > Codespaces; ensure machine access and spending limits allow allocation.","Try a different --location or omit it to let the API pick a default region.","As a workaround, create via the web UI (gh codespace create --web) which surfaces richer errors."],"exampleFix":"# before\ngh codespace create -R octocat/no-devcontainer-repo\n# error: error creating codespace: there are no available machine types for this repository\n\n# after\n# add .devcontainer/devcontainer.json to the repo, then:\ngh codespace create -R octocat/no-devcontainer-repo","handlingStrategy":"validation","validationCode":"# sanity-check the repo exposes machine types before creating\ngh api /repos/owner/repo 2>/dev/null | grep -q '\"id\"' || { echo 'repo unreachable'; exit 1; }\n# and ensure a devcontainer exists on the target branch\ngit ls-remote --heads origin main >/dev/null","typeGuard":null,"tryCatchPattern":"if err := runCreate(); err != nil {\n    if strings.Contains(err.Error(), \"no available machine types\") {\n        return fmt.Errorf(\"add .devcontainer/devcontainer.json and check codespaces org policy/spending limits\")\n    }\n    return err\n}","preventionTips":["Commit a valid devcontainer.json before enabling codespace automation on a repo.","Pre-verify org policy allows machine access and the spending limit is non-zero.","Fall back to --web creation when CLI allocation fails, to see richer errors."],"tags":["codespaces","machine-types","devcontainer","creation"],"backgroundTag":null,"analyzedSha":"0eeec0b92edbe70199f9768522f831d3534f41ad","analyzedAt":"2026-08-15T12:31:05.478Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}