dotnet/efcore · error · OperationException

Processing ' ' failed.

Error message

Processing '{inputFile}' failed.

What it means

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.').

Solutions

  1. Inspect the reporter output written before the exception — it lists the specific CompilerError messages that caused the failure.
  2. If templates were customized, revert them and retry to isolate the cause.
  3. Ensure the EF Core Design package version matches the runtime/tooling version used for scaffolding.
  4. Report the compiler errors to EF if they occur with unmodified templates.
Defensive patterns

Strategy: try-catch

Try / catch

try { var scaffolded = generator.GenerateModel(model, options); }
catch (OperationException ex) when (ex.Message.Contains("Processing"))
{
    // The reporter has already written each CompilerError; surface them to the user
    throw new InvalidOperationException("Scaffolding template transformation failed; see preceding error output for details.", ex);
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of dotnet/efcore@3a2006ef56 (2026-08-11). Data as JSON: /api/errors/0af9471f8377b9e7. Report an issue: GitHub.

Appendix: source

Thrown at src/EFCore.Design/Scaffolding/Internal/CSharpModelGenerator.cs:124

            // output EntityType poco .cs file
            var entityTypeFileName = entityType.Name + host.Extension;
            resultingFiles.AdditionalFiles.Add(new ScaffoldedFile(entityTypeFileName, generatedCode));
        }

        return resultingFiles;
    }

    private string ProcessTemplate(ITextTransformation transformation)
    {
        var output = transformation.TransformText();

        foreach (CompilerError error in transformation.Errors)
        {
            _reporter.Write(error);
        }

        return transformation.Errors.HasErrors
            ? throw new OperationException(DesignStrings.ErrorGeneratingOutput(transformation.GetType().Name))
            : output;
    }
}

View on GitHub (pinned to 3a2006ef56)