{"record":{"id":"3a6bfdd840fde818","repo":"pulumi/pulumi","slug":"expected-project-number-and-access-token","errorCode":null,"errorMessage":"expected <project-number> and <access-token>","messagePattern":"expected <project-number> and <access-token>","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cmd/esc/cli/env_provider_gcp_login.go","lineNumber":83,"sourceCode":"\t\t\t\"\\n\" +\n\t\t\t\"See https://www.pulumi.com/docs/esc/integrations/dynamic-login-credentials/gcp-login/\\n\" +\n\t\t\t\"for the full provider reference.\\n\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tctx := cmd.Context()\n\n\t\t\tif err := env.esc.getCachedClient(ctx); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tref, args, err := env.getExistingEnvRef(ctx, args)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif ref.version != \"\" {\n\t\t\t\treturn errors.New(\"the provider command does not accept versions\")\n\t\t\t}\n\t\t\tif len(args) != 2 {\n\t\t\t\treturn errors.New(\"expected <project-number> and <access-token>\")\n\t\t\t}\n\t\t\tproject, err := strconv.ParseInt(args[0], 10, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"invalid project number %q: must be a positive integer\", args[0])\n\t\t\t}\n\t\t\tif project <= 0 {\n\t\t\t\treturn fmt.Errorf(\"invalid project number %q: must be a positive integer\", args[0])\n\t\t\t}\n\t\t\taccessToken := args[1]\n\n\t\t\tpath, err := resource.ParsePropertyPath(pathStr)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"invalid --path: %w\", err)\n\t\t\t}\n\n\t\t\tnode := buildGCPLoginStaticNode(project, accessToken, serviceAccount, tokenLifetime)\n\n\t\t\tvar envVars []envVar","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/cmd/esc/cli/env_provider_gcp_login.go#L65-L101","documentation":"The GCP login provider command requires exactly two positional arguments after the environment reference: a GCP project number and an access token. This error fires when the argument count after resolving the environment ref is anything other than 2.","triggerScenarios":"Calling the subcommand with zero, one, or three-plus positional args, e.g. omitting the access token, passing flags that cobra does not consume, or forgetting one operand entirely.","commonSituations":"Forgetting the access token in scripts; quoting mistakes that split or join args; copying command lines from docs with placeholders left in; shell word-splitting removing empty-string tokens.","solutions":["Pass exactly two positional arguments: <project-number> <access-token>.","Quote the access token if it contains special characters.","Check the command's usage/help output for the exact argument order.","Ensure environment variables used in scripts (e.g. $GCP_TOKEN) are non-empty before invoking."],"exampleFix":"// before (missing token)\nesc env configure gcp-login my-org/my-proj/my-env 123456789\n// after\nesc env configure gcp-login my-org/my-proj/my-env 123456789 \"$GCP_ACCESS_TOKEN\"","handlingStrategy":"validation","validationCode":"if len(args) != 2 {\n    return fmt.Errorf(\"usage: %s <org/project/env> <project-number> <access-token>\", cmd.Use)\n}","typeGuard":null,"tryCatchPattern":"if err := cmd.Run(); err != nil {\n    if strings.Contains(err.Error(), \"expected <project-number> and <access-token>\") {\n        return fmt.Errorf(\"pass exactly two positional args after the env ref\")\n    }\n    return err\n}","preventionTips":["Quote all arguments, especially tokens with special characters.","Verify shell variables are non-empty before invocation.","Check `--help` for exact positional argument order."],"tags":["cli","arguments","gcp","esc"],"backgroundTag":"missing-required-argument","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}