{"record":{"id":"c9b2a5f4d85f438d","repo":"sipeed/picoclaw","slug":"the-no-truncate-option-can-only-be-used-in-conju","errorCode":null,"errorMessage":"the --no-truncate option can only be used in conjunction with --debug (-d)","messagePattern":"the --no-truncate option can only be used in conjunction with --debug \\(-d\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/picoclaw/internal/gateway/command.go","lineNumber":41,"sourceCode":"\t\treturn \"\", fmt.Errorf(\"invalid --host value: %w\", err)\n\t}\n\treturn normalized, nil\n}\n\nfunc NewGatewayCommand() *cobra.Command {\n\tvar debug bool\n\tvar noTruncate bool\n\tvar allowEmpty bool\n\tvar host string\n\n\tcmd := &cobra.Command{\n\t\tUse:     \"gateway\",\n\t\tAliases: []string{\"g\"},\n\t\tShort:   \"Start picoclaw gateway\",\n\t\tArgs:    cobra.NoArgs,\n\t\tPreRunE: func(_ *cobra.Command, _ []string) error {\n\t\t\tif noTruncate && !debug {\n\t\t\t\treturn fmt.Errorf(\"the --no-truncate option can only be used in conjunction with --debug (-d)\")\n\t\t\t}\n\n\t\t\tif noTruncate {\n\t\t\t\tutils.SetDisableTruncation(true)\n\t\t\t\tlogger.Info(\"String truncation is globally disabled via 'no-truncate' flag\")\n\t\t\t}\n\n\t\t\treturn nil\n\t\t},\n\t\tRunE: func(cmd *cobra.Command, _ []string) error {\n\t\t\tresolvedHost, err := resolveGatewayHostOverride(cmd.Flags().Changed(\"host\"), host)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif resolvedHost != \"\" {\n\t\t\t\tprevHost, hadPrev := os.LookupEnv(config.EnvGatewayHost)\n\t\t\t\tif err := os.Setenv(config.EnvGatewayHost, resolvedHost); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"failed to set %s: %w\", config.EnvGatewayHost, err)","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/cmd/picoclaw/internal/gateway/command.go#L23-L59","documentation":"`picoclaw gateway --no-truncate` globally disables string truncation and only makes sense attached to debug output, so PreRunE requires -d/--debug alongside it. Without --debug the command aborts before RunE and SetDisableTruncation is never called. Pure flag-misuse error; no gateway state involved.","triggerScenarios":"`picoclaw gateway --no-truncate` without -d/--debug on the same command line.","commonSituations":"Copy-pasting a debug flag set into a production launch script; leaving the flag behind after a debugging session.","solutions":["Add the required flag: `picoclaw gateway --debug --no-truncate`","Or drop --no-truncate for normal runs","In scripts, define the launch flags in one variable so debug and no-truncate stay paired"],"exampleFix":"# before\npicoclaw gateway --no-truncate\n# after\npicoclaw gateway --debug --no-truncate","handlingStrategy":"validation","validationCode":"# shell: keep the pair together\nFLAGS=\"--debug --no-truncate\"\npicoclaw gateway $FLAGS","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat --no-truncate as debug-only; never ship it alone","Group gateway launch flags in one variable so --debug and --no-truncate stay paired","Smoke-test launch scripts with `picoclaw gateway --help` style dry checks"],"tags":["gateway","cli","flags","usage"],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}