Skip to content

buf format produces a syntax error in v1.171.0 #4593

Description

@lukasbindreiter

GitHub repository with your minimal reproducible example (do not leave this field blank or fill out this field with "github.com/bufbuild/buf" or we will automatically close your issue, see the instructions above!)

https://github.com/tilebox/api/blob/main/apis/tilebox/v1/id.proto

Commands

# id.proto (see below) in the current directory

buf format -w .
buf lint .

Output

> buf lint .
# passes
> buf format -w .
# reformats
> buf lint .
id.proto:11:18:encountered unmatched `[` delimiter
id.proto:11:18:unexpected `[` after definition
id.proto:11:18:unexpected `[` in message definition
id.proto:11:19:missing name in message field
...

Expected Output

expecting buf format to not produce a syntax error

Anything else?

Had no issue so far with previous versions, but after upgrading to 1.71.0 the new behaviour is now as described in the issue.

This is the exact id.proto file that results in an error:

before formatting:

edition = "2023";

package tilebox.v1;

import "buf/validate/validate.proto";

option features.field_presence = IMPLICIT;

// Bytes field (in message)
message ID {
  bytes uuid = 1 [(buf.validate.field).bytes = {
    len: 16
    not_in: [
      "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" // Nil UUID
    ]
  }];
}

after formatting:

edition = "2023";

package tilebox.v1;

import "buf/validate/validate.proto";

option features.field_presence = IMPLICIT;

// Bytes field (in message)
message ID {
  bytes uuid = 1 [(buf.validate.field).bytes = {
    len: 16
    not_in: ["\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" // Nil UUID]
  }];
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions