{"record":{"id":"8b93a601421adc41","repo":"stride3d/stride","slug":"error-at-line-column-msg-source","errorCode":null,"errorMessage":"Error at {line}:{column}: {msg}","messagePattern":"Error at (.+?):(.+?): (.+?)","errorType":"exception","errorClass":"LexerException","httpStatus":null,"severity":"error","filePath":"sources/shaders/Stride.Shaders.Parsers/CppNet/Source.cs","lineNumber":283,"sourceCode":"                    case Token.CPPCOMMENT:\n                    case Token.WHITESPACE:\n                        break;\n                    default:\n                        /* XXX Check white, if required. */\n                        if(white)\n                            warning(tok.getLine(), tok.getColumn(),\n                                            \"Unexpected nonwhite token\");\n                        break;\n                }\n            }\n        }\n\n        protected void error(int line, int column, String msg)\n        {\n            if(listener != null)\n                listener.handleError(this, line, column, msg);\n            else\n                throw new LexerException(\"Error at \" + line + \":\" + column + \": \" + msg);\n        }\n\n        protected void warning(int line, int column, String msg)\n        {\n            if(werror)\n                error(line, column, msg);\n            else if(listener != null)\n                listener.handleWarning(this, line, column, msg);\n            else\n                throw new LexerException(\"Warning at \" + line + \":\" + column + \": \" + msg);\n        }\n\n        public virtual void close()\n        {\n        }\n    }\n\n}","sourceCodeStart":265,"sourceCodeEnd":301,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/shaders/Stride.Shaders.Parsers/CppNet/Source.cs#L265-L301","documentation":"Source.error() reports a preprocessing error: with a PreprocessorListener installed it calls listener.handleError(); otherwise it throws LexerException(\"Error at line:column: msg\"). It is the base-class error channel used by all Lexer/Source implementations.","triggerScenarios":"Any error diagnosed in a Source-derived lexer (bad tokens, unterminated constructs, #error directives) while no listener is attached — including warnings escalated via werror from warning().","commonSituations":"Running the preprocessor headlessly without a listener on malformed shader code; enabling warnings-as-errors so a mere warning surfaces here.","solutions":["Install a PreprocessorListener to collect errors without exceptions","Fix the shader source at the reported line:column","Catch LexerException around preprocessing and surface the message","Disable werror if a warning was escalated unintentionally"],"exampleFix":"// before\ntry { pp.process(); }\ncatch (LexerException e) { throw e; }\n// after\npp.setListener(new CollectingListener());\ntry { pp.process(); }\ncatch (LexerException e) { log(e.Message); }","handlingStrategy":"try-catch","validationCode":"if (source.getListener() == null) source.setListener(new DefaultPreprocessorListener());","typeGuard":null,"tryCatchPattern":"try { RunPreprocessor(source); } catch (LexerException e) when (e.Message.StartsWith(\"Error at \")) { log.Error($\"Shader preprocessing failed: {e.Message}\"); }","preventionTips":["Attach a listener to every Source/Preprocessor to avoid exception-based control flow","Lint shader sources before preprocessing to catch #error and malformed tokens"],"tags":["shader","preprocessor","error-reporting"],"backgroundTag":"invalid-argument-value","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}