Cannot invoke "org.antlr.v4.runtime.Token.getText()" because "ctx.messageName" is null
Hello!
I'm getting this type of error. It says like proto file contains an error. But my proto files has no error, because they can be generated with gradle tasks. Its giving error only in KMP
Task :composeApp:generateMPProtos FAILED line 5:7 token recognition error at: '"google/' line 5:23 token recognition error at: '/t' line 5:15 mismatched input 'protobuf' expecting {'public', COMMENT_OR_WS, WS, VALUE_STRING} line 5:39 token recognition error at: '";' line 6:7 token recognition error at: '"google/' line 6:23 token recognition error at: '/w' line 6:15 mismatched input 'protobuf' expecting {'public', COMMENT_OR_WS, WS, VALUE_STRING} line 6:38 token recognition error at: '";' line 5:7 token recognition error at: '"google/' line 5:23 token recognition error at: '/t' line 5:15 mismatched input 'protobuf' expecting {'public', COMMENT_OR_WS, WS, VALUE_STRING} line 5:39 token recognition error at: '";' line 6:7 token recognition error at: '"google/' line 6:23 token recognition error at: '/w' line 6:15 mismatched input 'protobuf' expecting {'public', COMMENT_OR_WS, WS, VALUE_STRING} line 6:38 token recognition error at: '";' line 13:7 token recognition error at: '"vendors/' line 13:23 token recognition error at: '-' line 13:16 mismatched input 'vendors' expecting {'public', COMMENT_OR_WS, WS, VALUE_STRING} line 13:35 token recognition error at: '";' line 5:7 token recognition error at: '"google/' line 5:23 token recognition error at: '/t' line 5:15 mismatched input 'protobuf' expecting {'public', COMMENT_OR_WS, WS, VALUE_STRING} line 5:39 token recognition error at: '";' line 6:7 token recognition error at: '"google/' line 6:23 token recognition error at: '/w' line 6:15 mismatched input 'protobuf' expecting {'public', COMMENT_OR_WS, WS, VALUE_STRING} line 6:38 token recognition error at: '";' line 13:7 token recognition error at: '"vendor-' line 13:23 token recognition error at: '/v' line 13:15 mismatched input 'showcase' expecting {'public', COMMENT_OR_WS, WS, VALUE_STRING} line 13:30 token recognition error at: '-' line 13:39 token recognition error at: '-' line 13:51 token recognition error at: '";' line 5:7 token recognition error at: '"google/' line 5:23 token recognition error at: '/t' line 5:15 mismatched input 'protobuf' expecting {'public', COMMENT_OR_WS, WS, VALUE_STRING} line 5:39 token recognition error at: '";' line 6:7 token recognition error at: '"google/' line 6:23 token recognition error at: '/w' line 6:15 mismatched input 'protobuf' expecting {'public', COMMENT_OR_WS, WS, VALUE_STRING} line 6:38 token recognition error at: '";' line 5:7 token recognition error at: '"google/' line 5:23 token recognition error at: '/t' line 5:15 mismatched input 'protobuf' expecting {'public', COMMENT_OR_WS, WS, VALUE_STRING} line 5:39 token recognition error at: '";' line 6:7 token recognition error at: '"google/' line 6:23 token recognition error at: '/w' line 6:15 mismatched input 'protobuf' expecting {'public', COMMENT_OR_WS, WS, VALUE_STRING} line 6:38 token recognition error at: '";' line 5:7 token recognition error at: '"google/' line 5:23 token recognition error at: '/t' line 5:15 mismatched input 'protobuf' expecting {'public', COMMENT_OR_WS, WS, VALUE_STRING} line 5:39 token recognition error at: '";' line 6:7 token recognition error at: '"google/' line 6:23 token recognition error at: '/w' line 6:15 mismatched input 'protobuf' expecting {'public', COMMENT_OR_WS, WS, VALUE_STRING} line 6:38 token recognition error at: '";' line 5:7 token recognition error at: '"google/' line 5:23 token recognition error at: '/t' line 5:15 mismatched input 'protobuf' expecting {'public', COMMENT_OR_WS, WS, VALUE_STRING} line 5:39 token recognition error at: '";' line 6:7 token recognition error at: '"google/' line 6:23 token recognition error at: '/w' line 6:15 mismatched input 'protobuf' expecting {'public', COMMENT_OR_WS, WS, VALUE_STRING} line 6:38 token recognition error at: '";' line 13:7 token recognition error at: '"vendor-' line 13:23 token recognition error at: '/v' line 13:15 mismatched input 'showcase' expecting {'public', COMMENT_OR_WS, WS, VALUE_STRING} line 13:30 token recognition error at: '-' line 13:39 token recognition error at: '-' line 13:51 token recognition error at: '";' line 14:7 token recognition error at: '"vendors/' line 14:23 token recognition error at: '-' line 14:16 mismatched input 'vendors' expecting {'public', COMMENT_OR_WS, WS, VALUE_STRING} line 14:35 token recognition error at: '";' line 5:7 token recognition error at: '"google/' line 5:23 token recognition error at: '/t' line 5:15 mismatched input 'protobuf' expecting {'public', COMMENT_OR_WS, WS, VALUE_STRING} line 5:39 token recognition error at: '";' line 6:7 token recognition error at: '"google/' line 6:23 token recognition error at: '/w' line 6:15 mismatched input 'protobuf' expecting {'public', COMMENT_OR_WS, WS, VALUE_STRING} line 6:38 token recognition error at: '";' line 13:7 token recognition error at: '"showcase/' line 13:25 token recognition error at: '-' line 13:17 mismatched input 'showcase' expecting {'public', COMMENT_OR_WS, WS, VALUE_STRING} line 13:37 token recognition error at: '";' line 5:7 token recognition error at: '"google/' line 5:23 token recognition error at: '/t' line 5:15 mismatched input 'protobuf' expecting {'public', COMMENT_OR_WS, WS, VALUE_STRING} line 5:39 token recognition error at: '";' line 6:7 token recognition error at: '"google/' line 6:23 token recognition error at: '/w' line 6:15 mismatched input 'protobuf' expecting {'public', COMMENT_OR_WS, WS, VALUE_STRING} line 6:38 token recognition error at: '";' line 138:9 mismatched input 'message' expecting {COMMENT_OR_WS, EXPRESSION_NAME} line 138:17 mismatched input '=' expecting {COMMENT_OR_WS, EXPRESSION_NAME}
Hi @Kratos1013. Please check that you are not using the reserved keyword message as a field. That might be the reason why
Can you post your proto file that has this error?