{"record":{"id":"476592aa7108a951","repo":"juanfont/headscale","slug":"at-least-one-scope-is-required-w","errorCode":null,"errorMessage":"at least one --scope is required: %w","messagePattern":"at least one --scope is required: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/headscale/cli/oauth_client.go","lineNumber":63,"sourceCode":"\tLong: `Create a general-purpose OAuth client. It authenticates with the OAuth 2.0\nclient-credentials grant and mints short-lived, scope-limited access tokens.\nThe wire format is compatible with Tailscale tooling (the Terraform provider,\nthe Kubernetes operator, tscli, ...), so those can drive Headscale unchanged.\n\nThe client secret is shown ONCE on creation and cannot be retrieved again; if\nyou lose it, delete the client and create a new one.\n\nScopes gate what the client's tokens may do; tags are the device tags those\ntokens may assign and are required when the scopes include devices:core or\nauth_keys.`,\n\tAliases: []string{\"c\", cmdNew},\n\tRunE: func(cmd *cobra.Command, _ []string) error {\n\t\tscopes, _ := cmd.Flags().GetStringArray(\"scope\")\n\t\ttags, _ := cmd.Flags().GetStringArray(\"tag\")\n\t\tdescription, _ := cmd.Flags().GetString(\"description\")\n\n\t\tif len(scopes) == 0 {\n\t\t\treturn fmt.Errorf(\"at least one --scope is required: %w\", errMissingParameter)\n\t\t}\n\n\t\tctx, client, cancel, err := newV2Client()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer cancel()\n\n\t\tkeyType := \"client\"\n\n\t\tresp, err := client.CreateKeyWithResponse(ctx, oauthTailnet, clientv2.CreateKeyRequest{\n\t\t\tKeyType:     &keyType,\n\t\t\tScopes:      &scopes,\n\t\t\tTags:        &tags,\n\t\t\tDescription: &description,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"creating oauth client: %w\", err)","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/cmd/headscale/cli/oauth_client.go#L45-L81","documentation":"Error \"at least one --scope is required: %w\" thrown in juanfont/headscale.","triggerScenarios":"Thrown at cmd/headscale/cli/oauth_client.go:63 when the library encounters an invalid state.","commonSituations":"Creating an OAuth client requires at least one --scope flag. Pass one or more scopes, e.g. --scope openid.","solutions":["Inspect the wrapped error for the underlying cause and correct the failing condition (at least one --scope is required); retry the operation after fixing the input, configuration, or environment."],"exampleFix":"Inspect the wrapped error for the underlying cause and correct the failing condition (at least one --scope is required); retry the operation after fixing the input, configuration, or environment.","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"565fd254d06c4c7f9a8cad1714a43445c79ba420","analyzedAt":"2026-08-15T13:12:30.133Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}