google / google/protobuf.dart

Pre-generated well-known types packaged into protobuf cannot be found

Open Beginner friendly
#1,086 3 comments 3 reactions 0 assignees View on GitHub
bug
Dominant language
Dart
Stars
572
Forks
196
Avg merge
1h 59m
Merged PRs (30d)
2

Description

Hello,

We've just updated our protobuf dependencies for our applications, and noticed those well-known types from Google are now pre-packaged into the protobuf package (https://github.com/google/protobuf.dart/pull/1081).

That's great, but right now it seems like some of the pre-generated files are missing.

### My configuration:

Windows 11
Flutter 3.32.8
protoc compiler v33.0
dart protoc_plugin v25.0.0
dart protobuf package v6.0.0

### Problem

When I try to generate some of my protos, the output files end up with export declarations looking like this:
```dart
export 'package:protobuf/well_known_types/google/protobuf/any.pbenum.dart';
export 'package:protobuf/well_known_types/google/protobuf/empty.pbenum.dart';
```

The problem here is that those 2 exported files:
`any.pbenum.dart`
`empty.pbenum.dart`
do not actually exist in the protobuf repository, so I get a runtime error when I try to build my application:

`[REDACTED]/lib/src/file_transfer.pbenum.dart(17,1): error GBB7C8005: Error when reading '[REDACTED]/dart-pub-cache/hosted/pub.dev/protobuf-6.0.0/lib/well_known_types/google/protobuf/any.pbenum.dart': The system cannot find the file specified.`

If I navigate to that exact location in my filesystem, I can see that those files indeed do not exist. Only these files actually exist:
```
$ ls -1
any.pb.dart
any.pbjson.dart
api.pb.dart
api.pbjson.dart
duration.pb.dart
duration.pbjson.dart
empty.pb.dart
empty.pbjson.dart
field_mask.pb.dart
field_mask.pbjson.dart
source_context.pb.dart
source_context.pbjson.dart
struct.pb.dart
struct.pbenum.dart
struct.pbjson.dart
timestamp.pb.dart
timestamp.pbjson.dart
type.pb.dart
type.pbenum.dart
type.pbjson.dart
wrappers.pb.dart
wrappers.pbjson.dart
```

I guess in the meantime, we can downgrade to the previous version and continue to generate the well-known types ourselves, just like we did until now. But it would be nice to fix this issue too :-)

Thanks

Contributor guide

Open the contributing guide

Research direction

Start by inspecting the generated files under lib/well_known_types/google/protobuf and the protoc_plugin output that exports any.pbenum.dart and empty.pbenum.dart. Compare the available well-known type artifacts with the generated exports, then run the relevant package generation or build checks. Done means protobuf 6.0.0 contains every exported file and applications using these types build successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.