{"record":{"id":"689b20c8793c2f71","repo":"microsoft/semantic-kernel","slug":"parsing-of-protofilename-proto-document-has-f","errorCode":null,"errorMessage":"Parsing of '{protoFileName}' .proto document has failed. Details: {string.Join(\";\", errors.AsEnumerable())}","messagePattern":"Parsing of '(.+?)' \\.proto document has failed\\. Details: (.+?)","errorType":"exception","errorClass":"KernelException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Functions/Functions.Grpc/Protobuf/ProtoDocumentParser.cs","lineNumber":38,"sourceCode":"    /// </summary>\n    /// <param name=\"protoDocument\">The .proto document.</param>\n    /// <param name=\"protoFileName\">The .proto file logical name.</param>\n    /// <returns>List of gRPC operations.</returns>\n    public IList<GrpcOperation> Parse(Stream protoDocument, string protoFileName)\n    {\n        Verify.NotNull(protoDocument);\n        Verify.NotNullOrWhiteSpace(protoFileName);\n\n        using var textReader = new StreamReader(protoDocument);\n\n        var descriptor = new FileDescriptorSet();\n        descriptor.Add(protoFileName, source: textReader);\n        descriptor.Process();\n\n        var errors = descriptor.GetErrors();\n        if (errors is not null && errors.Length != 0)\n        {\n            throw new KernelException($\"Parsing of '{protoFileName}' .proto document has failed. Details: {string.Join(\";\", errors.AsEnumerable())}\");\n        }\n\n        return this.GetGrpcOperations(descriptor.Files.Single());\n    }\n\n    /// <summary>\n    /// Parses an .proto document and extracts gRPC operations.\n    /// </summary>\n    /// <param name=\"model\">The .proto document model.</param>\n    /// <returns>List of gRPC operations.</returns>\n    private List<GrpcOperation> GetGrpcOperations(FileDescriptorProto model)\n    {\n        var operations = new List<GrpcOperation>();\n\n        foreach (var service in model.Services)\n        {\n            foreach (var method in service.Methods)\n            {","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Functions/Functions.Grpc/Protobuf/ProtoDocumentParser.cs#L20-L56","documentation":"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.","triggerScenarios":"A .proto with syntax errors: undefined message types, missing semicolons, invalid field numbers, undeclared imports, malformed package/service definitions.","commonSituations":"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).","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\";`)."],"exampleFix":"// before\nmessage Req { string id = 1 bad }\n// after\nmessage Req { string id = 1; }","handlingStrategy":"try-catch","validationCode":"// Validate the .proto with `protoc --proto_path=. file.proto` before shipping.","typeGuard":null,"tryCatchPattern":"try { /* parse */ }\ncatch (KernelException ex) when (ex.Message.Contains(\".proto document has failed\")) {\n    // ex.Message lists parse errors; report them to the .proto author\n}","preventionTips":["Lint .proto files in CI.","Declare `syntax = \"proto3\";` and add required imports."],"tags":["grpc","protobuf","parsing","configuration"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}