{"record":{"id":"edcde17b6a3598db","repo":"grafana/k6","slug":"the-local-execution-flag-is-not-compatible-with-edcde1","errorCode":null,"errorMessage":"the --local-execution flag is not compatible with the --show-logs flag","messagePattern":"the --local-execution flag is not compatible with the --show-logs flag","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cmd/cloud_run.go","lineNumber":116,"sourceCode":"\tthisCmd.Flags().SortFlags = false\n\tthisCmd.Flags().AddFlagSet(cloudRunCmd.flagSet())\n\tthisCmd.Flags().AddFlagSet(cloudCmd.flagSet())\n\n\treturn thisCmd\n}\n\nfunc (c *cmdCloudRun) preRun(cmd *cobra.Command, args []string) error {\n\tif c.localExecution {\n\t\tif cmd.Flags().Changed(\"exit-on-running\") {\n\t\t\treturn errext.WithExitCodeIfNone(\n\t\t\t\tfmt.Errorf(\"the --local-execution flag is not compatible with the --exit-on-running flag\"),\n\t\t\t\texitcodes.InvalidConfig,\n\t\t\t)\n\t\t}\n\n\t\tif cmd.Flags().Changed(\"show-logs\") {\n\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,","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/cmd/cloud_run.go#L98-L134","documentation":"The `k6 cloud run` preRun hook rejects combining --local-execution with --show-logs. Cloud log streaming is a cloud-execution feature; with --local-execution the test's logs are already printed locally, so the flag contradicts the mode. The error exits with code InvalidConfig (104).","triggerScenarios":"Invoking `k6 cloud run --local-execution --show-logs ...` — the check fires whenever the flag was changed, regardless of the value given.","commonSituations":"Copy-pasting cloud flags from an existing `k6 cloud` pipeline into the new local-execution flow; CI templates that always pass --show-logs/--no-show-logs.","solutions":["Remove --show-logs when using --local-execution; local logs are shown by default","Or drop --local-execution to keep streaming cloud logs","Update shared CI flag sets to branch on execution mode"],"exampleFix":"# before\nk6 cloud run --local-execution --show-logs script.js\n# after\nk6 cloud run --local-execution script.js","handlingStrategy":"validation","validationCode":"// wrapper-level guard before invoking k6\nfor _, a := range os.Args {\n    if a == \"--show-logs\" || strings.HasPrefix(a, \"--show-logs=\") {\n        if localExecution {\n            log.Fatal(\"--show-logs cannot be combined with --local-execution\")\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Branch flag templates on local vs cloud execution","Remove cloud-only flags when adopting --local-execution","Treat exit code 104 as a configuration bug in the wrapper, not a runtime failure"],"tags":["cli","flags","cloud-run","invalid-config"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}