COCKROACH-DEBUG-DECODE-PROTO(1)

NAME

cockroach-debug-decode-proto - decode-proto --name=

SYNOPSIS

cockroach debug decode-proto [flags]

DESCRIPTION

Read from stdin and attempt to decode any hex, base64, or C-escaped encoded protos and output them as JSON. If --single is specified, the input is expected to consist of a single encoded proto. Otherwise, the input can consist of multiple fields, separated by new lines and tabs. Each field is attempted to be decoded and, if that's unsuccessful, is echoed as is.

The default value for --schema is 'cockroach.sql.sqlbase.Descriptor'. For example:

$ cat debug/system.descriptor.txt | cockroach debug decode-proto
id    descriptor
1    {"database": {"id": 1, "modificationTime": {}, "name": "system", "privileges": {"users": [{"privileges": 48, "user": "admin"}, {"privileges": 48, "user": "root"}]}}}

decode-proto can be used to decode protos as captured by Chrome Dev Tools from HTTP network requests ("Copy as cURL"). Chrome captures these as UTF8-encoded raw bytes, which are then rendered as C-escaped strings. The UTF8 encoding breaks the proto encoding, so the curl command doesn't work as Chrome presents it. To rectify that, take the string argument passed to "curl --data" and pass it to "cockroach decode-proto --single --binary --out=". Then, to replay the HTTP request, do something like: $ curl -X POST 'http://localhost:8080/ts/query' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/x-protobuf' \
  --data-binary @

OPTIONS

--binary[=false]
    output the protos as binary instead of JSON. If specified, --out also needs to be specified.

--emit-defaults[=false]
    encode default values for every field

-h, --help[=false]
    help for decode-proto

--out=""
    path to output file. If not specified, output goes to stdout.

--schema="cockroach.sql.sqlbase.Descriptor"
    fully qualified name of the proto to decode

--single[=false]
    treat the input as a single field

OPTIONS INHERITED FROM PARENT COMMANDS

--enterprise-require-fips-ready[=false]
    abort if FIPS readiness checks fail

--log=

Logging configuration, expressed using YAML syntax. For example, you can
 change the default logging directory with: --log='file-defaults: {dir: ...}'.
 See the documentation for more options and details. To preview how the log
 configuration is applied, or preview the default configuration, you can use
 the 'cockroach debug check-log-config' sub-command.

--log-config-file=

File name to read the logging configuration from. This has the same effect as
 passing the content of the file via the --log flag.

--log-config-vars=[]

Environment variables that will be expanded if present in the body of the
 logging configuration.

--log-dir=

--log-dir=XXX is an alias for --log='file-defaults: {dir: XXX}'.

--logtostderr[=UNKNOWN]

--logtostderr=XXX is an alias for --log='sinks: {stderr: {filter: XXX}}'. If
 no value is specified, the default value for the command is inferred: INFO for
 server commands, WARNING for client commands.

--redactable-logs=false

--redactable-logs=XXX is an alias for --log='file-defaults: {redactable:
 XXX}}'.

--vmodule=
    comma-separated list of pattern=N settings for file-filtered logging (significantly hurts performance)

SEE ALSO

cockroach-debug(1)

HISTORY

13-May-2026 Auto generated by spf13/cobra