microsoft/semantic-kernel · error · KernelException
Parsing of '{protoFileName}' .proto document has failed. Det
Error message
Parsing of '{protoFileName}' .proto document has failed. Details: {string.Join(";", errors.AsEnumerable())} What it means
Thrown by ProtoDocumentParser when, after adding the .proto to a FileDescriptorSet and calling Process(), `descriptor.GetErrors()` returns one or more errors. The message joins all errors with ';'. This is a schema-level parse failure distinct from a missing file.
Source
Thrown at dotnet/src/Functions/Functions.Grpc/Protobuf/ProtoDocumentParser.cs:38
/// </summary>
/// <param name="protoDocument">The .proto document.</param>
/// <param name="protoFileName">The .proto file logical name.</param>
/// <returns>List of gRPC operations.</returns>
public IList<GrpcOperation> Parse(Stream protoDocument, string protoFileName)
{
Verify.NotNull(protoDocument);
Verify.NotNullOrWhiteSpace(protoFileName);
using var textReader = new StreamReader(protoDocument);
var descriptor = new FileDescriptorSet();
descriptor.Add(protoFileName, source: textReader);
descriptor.Process();
var errors = descriptor.GetErrors();
if (errors is not null && errors.Length != 0)
{
throw new KernelException($"Parsing of '{protoFileName}' .proto document has failed. Details: {string.Join(";", errors.AsEnumerable())}");
}
return this.GetGrpcOperations(descriptor.Files.Single());
}
/// <summary>
/// Parses an .proto document and extracts gRPC operations.
/// </summary>
/// <param name="model">The .proto document model.</param>
/// <returns>List of gRPC operations.</returns>
private List<GrpcOperation> GetGrpcOperations(FileDescriptorProto model)
{
var operations = new List<GrpcOperation>();
foreach (var service in model.Services)
{
foreach (var method in service.Methods)
{View on GitHub (pinned to c028a0c7dc)
Solutions
- Read the joined error details — they name the specific parse errors.
- Validate the .proto with `protoc` or a protobuf linter.
- Add missing `import` statements and fix syntax (e.g. declare `syntax = "proto3";`).
Example fix
// before
message Req { string id = 1 bad }
// after
message Req { string id = 1; } Defensive patterns
Strategy: try-catch
Validate before calling
// Validate the .proto with `protoc --proto_path=. file.proto` before shipping.
Try / catch
try { /* parse */ }
catch (KernelException ex) when (ex.Message.Contains(".proto document has failed")) {
// ex.Message lists parse errors; report them to the .proto author
} Prevention
- Lint .proto files in CI.
- Declare `syntax = "proto3";` and add required imports.
When it happens
Trigger: A .proto with syntax errors: undefined message types, missing semicolons, invalid field numbers, undeclared imports, malformed package/service definitions.
Common situations: Hand-editing a .proto and introducing a typo; .proto referencing types from another file without an import statement; protobuf version mismatch (proto2 vs proto3 syntax).
Related errors
- No '{fullTypeName}' message type is found while resolving da
- No .proto document for the specified path - {filePath} is fo
- No address provided for the '{operation.Name}' gRPC operatio
- The address '{address}' for the '{operation.Name}' gRPC oper
- The URI scheme '{addressUri.Scheme}' is not allowed for the
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/689b20c8793c2f71.
Report an issue: GitHub.