{"record":{"id":"0af9471f8377b9e7","repo":"dotnet/efcore","slug":"processing-inputfile-failed","errorCode":null,"errorMessage":"Processing '{inputFile}' failed.","messagePattern":"Processing '(.+?)' failed\\.","errorType":"exception","errorClass":"OperationException","httpStatus":null,"severity":"error","filePath":"src/EFCore.Design/Scaffolding/Internal/CSharpModelGenerator.cs","lineNumber":124,"sourceCode":"            // output EntityType poco .cs file\n            var entityTypeFileName = entityType.Name + host.Extension;\n            resultingFiles.AdditionalFiles.Add(new ScaffoldedFile(entityTypeFileName, generatedCode));\n        }\n\n        return resultingFiles;\n    }\n\n    private string ProcessTemplate(ITextTransformation transformation)\n    {\n        var output = transformation.TransformText();\n\n        foreach (CompilerError error in transformation.Errors)\n        {\n            _reporter.Write(error);\n        }\n\n        return transformation.Errors.HasErrors\n            ? throw new OperationException(DesignStrings.ErrorGeneratingOutput(transformation.GetType().Name))\n            : output;\n    }\n}\n","sourceCodeStart":106,"sourceCodeEnd":128,"githubUrl":"https://github.com/dotnet/efcore/blob/3a2006ef569de08368d59db5e1468aa8f407e4f8/src/EFCore.Design/Scaffolding/Internal/CSharpModelGenerator.cs#L106-L128","documentation":"Thrown by ProcessTemplate when the T4 text-template transformation (used to generate the DbContext/model source during scaffolding) reports compiler errors. Each error is written to the reporter, and if any errors exist the whole scaffolding run fails with OperationException (DesignStrings.ErrorGeneratingOutput, displayed as 'Processing ... failed.').","triggerScenarios":"The T4 template host encounters compilation/execution errors while transforming the DbContext or model template — for example a template directive error, a missing assembly reference, or an exception inside the template's TransformText.","commonSituations":"Corrupt or customized T4 templates; missing assembly references needed by the template; an internal model state that the template cannot render; EF version change where the template expects different runtime data.","solutions":["Inspect the reporter output written before the exception — it lists the specific CompilerError messages that caused the failure.","If templates were customized, revert them and retry to isolate the cause.","Ensure the EF Core Design package version matches the runtime/tooling version used for scaffolding.","Report the compiler errors to EF if they occur with unmodified templates."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { var scaffolded = generator.GenerateModel(model, options); }\ncatch (OperationException ex) when (ex.Message.Contains(\"Processing\"))\n{\n    // The reporter has already written each CompilerError; surface them to the user\n    throw new InvalidOperationException(\"Scaffolding template transformation failed; see preceding error output for details.\", ex);\n}","preventionTips":["Keep the EF Core Design package version aligned with the runtime version.","Do not modify the built-in T4 templates; if customized, validate them against the model.","Capture the reporter output so template compiler errors are visible alongside the exception."],"tags":["scaffolding","reverse-engineering","t4-templates","code-generation"],"backgroundTag":null,"analyzedSha":"3a2006ef569de08368d59db5e1468aa8f407e4f8","analyzedAt":"2026-08-11T23:42:04.146Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}