{"record":{"id":"85c40ce6bced23dd","repo":"grafana/k6","slug":"the-no-cloud-logs-flag-can-only-be-used-in-conju","errorCode":null,"errorMessage":"the --no-cloud-logs flag can only be used in conjunction with the --local-execution flag","messagePattern":"the --no-cloud-logs 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":140,"sourceCode":"\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)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, fmt.Errorf(\"could not load and configure the test: %w\", err)\n\t\t\t}\n\n\t\t\tif err := createCloudTest(c.runCmd.gs, test); err != nil {\n\t\t\t\tif errors.Is(err, errCloudAuth) {\n\t\t\t\t\treturn nil, nil, err","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/cmd/cloud_run.go#L122-L158","documentation":"The `k6 cloud run` preRun hook rejects --no-cloud-logs without --local-execution. Disabling log push to the cloud only applies when execution is local (cloud-executed tests inherently log in the cloud), so the combination is contradictory. The error exits with code InvalidConfig (104).","triggerScenarios":"Invoking `k6 cloud run --no-cloud-logs ...` without --local-execution present on the command line.","commonSituations":"Cost/privacy-driven flag sets reused across commands; wrappers that always append --no-cloud-logs; migrating from `k6 run` with cloud output to `k6 cloud run`.","solutions":["Add --local-execution to keep logs purely local","Or drop --no-cloud-logs for cloud-executed runs","Gate the flag in CI scripts on the chosen execution mode"],"exampleFix":"# before\nk6 cloud run --no-cloud-logs script.js\n# after\nk6 cloud run --local-execution --no-cloud-logs script.js","handlingStrategy":"validation","validationCode":"if slices.Contains(args, \"--no-cloud-logs\") && !slices.Contains(args, \"--local-execution\") {\n    log.Fatal(\"--no-cloud-logs requires --local-execution\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat --no-cloud-logs as local-execution-only in command templates","Add wrapper-level flag-combination checks before shelling out","Map exit code 104 to a clear 'fix the flags' message in pipelines"],"tags":["cli","flags","cloud-run","logging","invalid-config"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}