{"record":{"id":"611f91e134a04a9e","repo":"grafana/k6","slug":"the-no-cloud-secrets-flag-can-only-be-used-in-co","errorCode":null,"errorMessage":"the --no-cloud-secrets flag can only be used in conjunction with the --local-execution flag","messagePattern":"the --no-cloud-secrets flag can only be used in conjunction with the --local-execution flag","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cmd/cloud_run.go","lineNumber":133,"sourceCode":"\t\t\treturn errext.WithExitCodeIfNone(\n\t\t\t\tfmt.Errorf(\"the --local-execution flag is not compatible with the --show-logs flag\"),\n\t\t\t\texitcodes.InvalidConfig,\n\t\t\t)\n\t\t}\n\n\t\treturn nil\n\t}\n\n\tif c.linger {\n\t\treturn errext.WithExitCodeIfNone(\n\t\t\tfmt.Errorf(\"the --linger flag can only be used in conjunction with the --local-execution flag\"),\n\t\t\texitcodes.InvalidConfig,\n\t\t)\n\t}\n\n\tif c.noCloudSecrets {\n\t\treturn errext.WithExitCodeIfNone(\n\t\t\tfmt.Errorf(\"the --no-cloud-secrets flag can only be used in conjunction with the --local-execution flag\"),\n\t\t\texitcodes.InvalidConfig,\n\t\t)\n\t}\n\n\tif c.noCloudLogs {\n\t\treturn errext.WithExitCodeIfNone(\n\t\t\tfmt.Errorf(\"the --no-cloud-logs flag can only be used in conjunction with the --local-execution flag\"),\n\t\t\texitcodes.InvalidConfig,\n\t\t)\n\t}\n\n\treturn c.deprecatedCloudCmd.preRun(cmd, args)\n}\n\nfunc (c *cmdCloudRun) run(cmd *cobra.Command, args []string) error {\n\tif c.localExecution {\n\t\tc.runCmd.loadConfiguredTest = func(*cobra.Command, []string) (*loadedAndConfiguredTest, execution.Controller, error) {\n\t\t\ttest, err := loadAndConfigureLocalTest(c.runCmd.gs, cmd, args, getCloudRunLocalExecutionConfig)","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/cmd/cloud_run.go#L115-L151","documentation":"The `k6 cloud run` preRun hook rejects --no-cloud-secrets without --local-execution. Automatic cloud secret-source configuration is a local-execution feature (the cloud runner resolves secrets server-side), so the flag has no effect for cloud-executed tests and is rejected up front. The error exits with code InvalidConfig (104).","triggerScenarios":"Invoking `k6 cloud run --no-cloud-secrets ...` without --local-execution on the same command line.","commonSituations":"Teams standardizing a flag set across local and cloud runs; copy-pasting a security-hardened local invocation into the cloud path.","solutions":["Add --local-execution if you intend to run locally without the cloud secret source","Or remove --no-cloud-secrets for cloud-executed tests","Split shared flag templates by execution mode"],"exampleFix":"# before\nk6 cloud run --no-cloud-secrets script.js\n# after\nk6 cloud run --local-execution --no-cloud-secrets script.js","handlingStrategy":"validation","validationCode":"if slices.Contains(args, \"--no-cloud-secrets\") && !slices.Contains(args, \"--local-execution\") {\n    log.Fatal(\"--no-cloud-secrets requires --local-execution\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep secret-related flags in the local-execution flag group only","Validate mode-dependent flags in CI wrappers before invocation","Use exit code 104 checks to fail fast on flag misuse"],"tags":["cli","flags","cloud-run","secrets","invalid-config"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}