sipeed/picoclaw · error

the --no-truncate option can only be used in conjunction wit

Error message

the --no-truncate option can only be used in conjunction with --debug (-d)

What it means

`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.

Source

Thrown at cmd/picoclaw/internal/gateway/command.go:41

		return "", fmt.Errorf("invalid --host value: %w", err)
	}
	return normalized, nil
}

func NewGatewayCommand() *cobra.Command {
	var debug bool
	var noTruncate bool
	var allowEmpty bool
	var host string

	cmd := &cobra.Command{
		Use:     "gateway",
		Aliases: []string{"g"},
		Short:   "Start picoclaw gateway",
		Args:    cobra.NoArgs,
		PreRunE: func(_ *cobra.Command, _ []string) error {
			if noTruncate && !debug {
				return fmt.Errorf("the --no-truncate option can only be used in conjunction with --debug (-d)")
			}

			if noTruncate {
				utils.SetDisableTruncation(true)
				logger.Info("String truncation is globally disabled via 'no-truncate' flag")
			}

			return nil
		},
		RunE: func(cmd *cobra.Command, _ []string) error {
			resolvedHost, err := resolveGatewayHostOverride(cmd.Flags().Changed("host"), host)
			if err != nil {
				return err
			}
			if resolvedHost != "" {
				prevHost, hadPrev := os.LookupEnv(config.EnvGatewayHost)
				if err := os.Setenv(config.EnvGatewayHost, resolvedHost); err != nil {
					return fmt.Errorf("failed to set %s: %w", config.EnvGatewayHost, err)

View on GitHub (pinned to 49183d7e8d)

Solutions

  1. Add the required flag: `picoclaw gateway --debug --no-truncate`
  2. Or drop --no-truncate for normal runs
  3. In scripts, define the launch flags in one variable so debug and no-truncate stay paired

Example fix

# before
picoclaw gateway --no-truncate
# after
picoclaw gateway --debug --no-truncate
Defensive patterns

Strategy: validation

Validate before calling

# shell: keep the pair together
FLAGS="--debug --no-truncate"
picoclaw gateway $FLAGS

Prevention

When it happens

Trigger: `picoclaw gateway --no-truncate` without -d/--debug on the same command line.

Common situations: Copy-pasting a debug flag set into a production launch script; leaving the flag behind after a debugging session.

Related errors


AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15). Data as JSON: /api/errors/c9b2a5f4d85f438d. Report an issue: GitHub.