go build_error ai_generated true

error: could not import "google/protobuf/timestamp.proto": file not found

ID: go/grpc-missing-proto-import

Also available as: JSON · Markdown · 中文
80%Fix Rate
84%Confidence
0Evidence
2024-09-10First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
1.9 active

Root Cause

The .proto file imports a dependency that is not in the protoc include path, causing compilation to fail.

generic

中文

.proto 文件导入的依赖不在 protoc 的包含路径中,导致编译失败。

Workarounds

  1. 90% success Add the protobuf include path to protoc
    protoc -I=. -I=/usr/include your.proto
  2. 85% success Use a dependency manager like Buf
    buf generate

Dead Ends

Common approaches that don't work:

  1. Copy the timestamp.proto file into the same directory 50% fail

    It may conflict with the system-wide protobuf installation and cause version mismatches.

  2. Remove the import and use a custom timestamp field 60% fail

    This changes the API and may break compatibility.