Snippet Generator not working

Jenkins 2.387.1.

The Snippet Generator is not working for us. For a given step, the correct fields appear but:

  • The help ‘?’ tips don’t work
  • The Generate Pipeline Script button generates no output.

Tested in Edge and Chrome - same negative results with both.

Any idea how to fix it please?

I can’t duplicate the problem as you’ve described it. Steps that I took:

  • Install Jenkins 2.387.1 with my plugins file
  • Open the /pipeline-syntax and select addErrorBadge from the dropdown list
  • Add short strings to each of the displayed fields
  • Press the “Generate Pipeline Script” button and confirm that the expected script is generated

You’ll need to provide enough details so that others can duplicate the problem.

Hi Mark,

Thanks for attempting to reproduce my problem.

It seems that I only see the problem for a few plugins:

  • copyArtifacts
  • recordIssues

For copyArtifacts, when I click Generate Pipeline Script I get a long exception starting:

Caught unhandled exception with ID d6ec59a6-5622-40d8-bc56-7f9bf77fbf20
java.lang.IllegalArgumentException: The frontend sent an unexpected list of classes (["hudson.plugins.copyartifact.StatusBuildSelector","hudson.plugins.copyartifact.SavedBuildSelector","hudson.plugins.copyartifact.TriggeredBuildSelector","hudson.plugins.copyartifact.DownstreamBuildSelector","hudson.plugins.copyartifact.LastBuildWithArtifactSelector","hudson.plugins.copyartifact.LastCompletedBuildSelector","hudson.plugins.copyartifact.PermalinkBuildSelector","hudson.plugins.copyartifact.SpecificBuildSelector","hudson.plugins.copyartifact.WorkspaceSelector","hudson.plugins.copyartifact.ParameterizedBuildSelector"]) rather than an expected single class. See https://www.jenkins.io/doc/developer/views/table-to-div-migration/ for more information.
	at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:748)
Caused: java.lang.IllegalArgumentException: Failed to instantiate class hudson.plugins.copyartifact.BuildSelector from {"stapler-class":["hudson.plugins.copyartifact.StatusBuildSelector","hudson.plugins.copyartifact.SavedBuildSelector","hudson.plugins.copyartifact.TriggeredBuildSelector","hudson.plugins.copyartifact.DownstreamBuildSelector","hudson.plugins.copyartifact.LastBuildWithArtifactSelector","hudson.plugins.copyartifact.LastCompletedBuildSelector","hudson.plugins.copyartifact.PermalinkBuildSelector","hudson.plugins.copyartifact.SpecificBuildSelector","hudson.plugins.copyartifact.WorkspaceSelector","hudson.plugins.copyartifact.ParameterizedBuildSelector"],"$class":["hudson.plugins.copyartifact.StatusBuildSelector","hudson.plugins.copyartifact.SavedBuildSelector","hudson.plugins.copyartifact.TriggeredBuildSelector","hudson.plugins.copyartifact.DownstreamBuildSelector","hudson.plugins.copyartifact.LastBuildWithArtifactSelector","hudson.plugins.copyartifact.LastCompletedBuildSelector","hudson.plugins.copyartifact.PermalinkBuildSelector","hudson.plugins.copyartifact.SpecificBuildSelector","hudson.plugins.copyartifact.WorkspaceSelector","hudson.plugins.copyartifact.ParameterizedBuildSelector"]}
	at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:769)
	at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:549)
	at org.kohsuke.stapler.RequestImpl.injectSetters(RequestImpl.java:936)
	at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:881)
	at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:766)

For recordIssues, when I click Generate Pipeline Script the exception starts:

Error while serving https://<snip>/pipeline-syntax/generateSnippet
java.lang.IllegalArgumentException: The frontend sent an unexpected list of classes (["io.jenkins.plugins.analysis.warnings.AcuCobol","io.jenkins.plugins.analysis.warnings.Gnat","io.jenkins.plugins.analysis.warnings.AndroidLint","io.jenkins.plugins.analysis.warnings.AnsibleLint","io.jenkins.plugins.analysis.warnings.AquaScanner","io.jenkins.plugins.analysis.warnings.Trivy","io.jenkins.plugins.analysis.warnings.ArmCc","io.jenkins.plugins.analysis.warnings.Ajc","io.jenkins.plugins.analysis.warnings.axivion.AxivionSuite","io.jenkins.plugins.analysis.warnings.BluePearl","io.jenkins.plugins.analysis.warnings.Brakeman","io.jenkins.plugins.analysis.warnings.Buckminster","io.jenkins.plugins.analysis.warnings.Ccm","io.jenkins.plugins.analysis.warnings.Cmake","io.jenkins.plugins.analysis.warnings.Cpd","io.jenkins.plugins.analysis.warnings.CppCheck","io.jenkins.plugins.analysis.warnings.CssLint","io.jenkins.plugins.analysis.warnings.Cadence","io.jenkins.plugins.analysis.warnings.Cargo","io.jenkins.plugins.analysis.warnings.CheckStyle","io.jenkins.plugins.analysis.warnings.Clair","io.jenkins.plugins.analysis.warnings.Clang","io.jenkins.plugins.analysis.warnings.ClangAnalyzer","io.jenkins.plugins.analysis.warnings.ClangTidy","io.jenkins.plugins.analysis.warnings.CodeAnalysis","io.jenkins.plugins.analysis.warnings.CodeGenerator","io.jenkins.plugins.analysis.warnings.CodeChecker","io.jenkins.plugins.analysis.warnings.CodeNarc","io.jenkins.plugins.analysis.warnings.Coolflux","io.jenkins.plugins.analysis.warnings.CppLint","io.jenkins.plugins.analysis.warnings.DScanner","io.jenkins.plugins.analysis.warnings.Dart","io.jenkins.plugins.analysis.warnings.Detekt","io.jenkins.plugins.analysis.warnings.DocFx","io.jenkins.plugins.analysis.warnings.DockerLint","io.jenkins.plugins.analysis.warnings.Doxygen","io.jenkins.plugins.analysis.warnings.DrMemory","io.jenkins.plugins.analysis.warnings.EsLint","io.jenkins.plugins.analysis.warnings.Eclipse","io.jenkins.plugins.analysis.warnings.EmbeddedEngineer","io.jenkins.plugins.analysis.warnings.Erlc","io.jenkins.plugins.analysis.warnings.ErrorProne","io.jenkins.plugins.analysis.warnings.FindBugs","io.jenkins.plugins.analysis.warnings.Flake8","io.jenkins.plugins.analysis.warnings.Flawfinder","io.jenkins.plugins.analysis.warnings.FlexSdk","io.jenkins.plugins.analysis.warnings.Fxcop","io.jenkins.plugins.analysis.warnings.GhsMulti","io.jenkins.plugins.analysis.warnings.Gcc4","io.jenkins.plugins.analysis.warnings.Gcc3","io.jenkins.plugins.analysis.warnings.GnuFortran","io.jenkins.plugins.analysis.warnings.Gendarme","io.jenkins.plugins.analysis.warnings.GoLint","io.jenkins.plugins.analysis.warnings.GoVet","io.jenkins.plugins.analysis.warnings.groovy.GroovyScript","io.jenkins.plugins.analysis.warnings.HadoLint","io.jenkins.plugins.analysis.warnings.IarCstat","io.jenkins.plugins.analysis.warnings.Iar","io.jenkins.plugins.analysis.warnings.Xlc","io.jenkins.plugins.analysis.warnings.IbLinter","io.jenkins.plugins.analysis.warnings.Infer","io.jenkins.plugins.analysis.warnings.Intel","io.jenkins.plugins.analysis.warnings.IdeaInspection","io.jenkins.plugins.analysis.warnings.JcReport","io.jenkins.plugins.analysis.warnings.JsLint","io.jenkins.plugins.analysis.warnings.JUnit","io.jenkins.plugins.analysis.warnings.Java","io.jenkins.plugins.analysis.warnings.JavaDoc","io.jenkins.plugins.analysis.warnings.JsHint","io.jenkins.plugins.analysis.warnings.KlocWork","io.jenkins.plugins.analysis.warnings.Kotlin","io.jenkins.plugins.analysis.warnings.KtLint","io.jenkins.plugins.analysis.warnings.MsBuild","io.jenkins.plugins.analysis.warnings.MavenConsole","io.jenkins.plugins.analysis.warnings.TagList","io.jenkins.plugins.analysis.warnings.MentorGraphics","io.jenkins.plugins.analysis.warnings.MetrowerksCodeWarrior","io.jenkins.plugins.analysis.warnings.MyPy","io.jenkins.plugins.analysis.warnings.NagFortran","io.jenkins.plugins.analysis.warnings.WarningsPlugin","io.jenkins.plugins.analysis.warnings.OTDockerLint","io.jenkins.plugins.analysis.warnings.OwaspDependencyCheck","io.jenkins.plugins.analysis.warnings.tasks.OpenTasks","io.jenkins.plugins.analysis.warnings.Invalids","io.jenkins.plugins.analysis.warnings.PcLint","io.jenkins.plugins.analysis.warnings.Pep8","io.jenkins.plugins.analysis.warnings.Php","io.jenkins.plugins.analysis.warnings.PhpStan","io.jenkins.plugins.analysis.warnings.PhpCodeSniffer","io.jenkins.plugins.analysis.warnings.Pit","io.jenkins.plugins.analysis.warnings.Pmd","io.jenkins.plugins.analysis.warnings.PreFast","io.jenkins.plugins.analysis.warnings.PVSStudio","io.jenkins.plugins.analysis.warnings.Perforce","io.jenkins.plugins.analysis.warnings.PerlCritic","io.jenkins.plugins.analysis.warnings.Polyspace","io.jenkins.plugins.analysis.warnings.ProtoLint","io.jenkins.plugins.analysis.warnings.PuppetLint","io.jenkins.plugins.analysis.warnings.PyDocStyle","io.jenkins.plugins.analysis.warnings.PyLint","io.jenkins.plugins.analysis.warnings.QacSourceCodeAnalyser","io.jenkins.plugins.analysis.warnings.QtTranslation","io.jenkins.plugins.analysis.warnings.RegisteredParser","io.jenkins.plugins.analysis.warnings.DupFinder","io.jenkins.plugins.analysis.warnings.ResharperInspectCode","io.jenkins.plugins.analysis.warnings.RevApi","io.jenkins.plugins.analysis.warnings.Robocopy","io.jenkins.plugins.analysis.warnings.RfLint","io.jenkins.plugins.analysis.warnings.RuboCop","io.jenkins.plugins.analysis.warnings.Sarif","io.jenkins.plugins.analysis.warnings.SunC","io.jenkins.plugins.analysis.warnings.Scala","io.jenkins.plugins.analysis.warnings.Simian","io.jenkins.plugins.analysis.warnings.SimulinkCheck","io.jenkins.plugins.analysis.warnings.SonarQube","io.jenkins.plugins.analysis.warnings.SphinxBuild","io.jenkins.plugins.analysis.warnings.SpotBugs","io.jenkins.plugins.analysis.warnings.StyleCop","io.jenkins.plugins.analysis.warnings.StyleLint","io.jenkins.plugins.analysis.warnings.SwiftLint","io.jenkins.plugins.analysis.warnings.TaskingVx","io.jenkins.plugins.analysis.warnings.Tnsdl","io.jenkins.plugins.analysis.warnings.TsLint","io.jenkins.plugins.analysis.warnings.TiCss","io.jenkins.plugins.analysis.warnings.VeraCodePipelineScanner","io.jenkins.plugins.analysis.warnings.DiabC","io.jenkins.plugins.analysis.warnings.XmlLint","io.jenkins.plugins.analysis.warnings.YuiCompressor","io.jenkins.plugins.analysis.warnings.YamlLint","io.jenkins.plugins.analysis.warnings.ZptLint","io.jenkins.plugins.analysis.warnings.OELintAdv"]) rather than an expected single class. See https://www.jenkins.io/doc/developer/views/table-to-div-migration/ for more information.
	at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:748)

The output that says:

indicates that you have one or more plugins installed that have not been updated to support the configuration form modernization that happened in Jenkins 2.277.1. The “migrating Jenkins” topic provides a detailed set of steps that you can follow to identify the plugin or plugins causing the issue.

Thanks Mark. I will have to read carefully the link you sent me. However, the controller was built recently and I think I have added only these plugins:

  • Active Directory
  • Copy Artifact
  • Environment Injector
  • ThinBackup
  • Warnings Next Generation
  • Subversion

Is it obvious which is the culprit?

Hi, I’m still struggling with this problem.

To recap, for some plugins (e.g. recordIssues and copyArtifacts) the Snippet Generator generates no pipeline script and the system log shows:

Caught unhandled exception with ID 7ac1b3fd-4b70-4d1c-b468-529dfe3b5d2f
java.lang.IllegalArgumentException: The frontend sent an unexpected list of classes (["io.jenkins.plugins.analysis.warnings.AcuCobol","io.jenkins.plugins.analysis.warnings.Gnat", <snip>

I have checked the plugins I installed against the known broken plugins dashboard and they are not listed there.

We also created a fresh instance of Jenkins with exactly the same plugins. The snippet generator works there as expected. So there is something different about the faulty two instances which are 6 months old. All 3 instances are on the latest LTS 2.387.2. The system info and env variables for the old and new instances are similar (only minor differences).

What could I try next to diagnose the problem?

@MarkEWaite May I ask you if you can offer any further advice on my issue please?

Unfortunately, I do not have any great ideas. You might compare the working system and the non-working system for things like:

  • Is the context where the pipeline syntax generator is opened the same in the passing and the failing case? For example, is it failing when opened from a different URL in one case than in the other?
  • Have you run the full set of configuration form modernization checks on both instances? If not, it may be worth running that complete set of checks, just in case you’ve found a new instance of a configuration form modernization problem
  • What other differences are there between the working and non-working systems?

@MarkEWaite May I follow-up on this issue please?

As originally explained, we have several Jenkins controllers. In all but one of them, the Snippet Generator, in certain cases, fails to generate any code and an exception is raised when it is used. I examined all the plugins but could not find an appreciable difference between the working and non-working controllers (expect that the non-working ones use the ActiveDirectory plugin).

However, today I realised that there is a significant difference. The non-working controllers use the Nginx reverse proxy server. The working controller does not. We moved the working system over to Nginx and it, too, no longer works, i.e. the snippet generator fails to generate output and an exception is raised.

I have installed the Strict Crumb Issuer Plugin and, in Configure Global Security > CSRF Protection I have:

Do you think that the Nginx configuration could be causing the problem?

I notice that the exception trace includes:

at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:154)

I’m reasonably confident that the nginx configuration is causing the problem. Compare your nginx configuration with the nginx reverse proxy configuration instructions and adapt your configuration to match the recommendations.

The video may also help, though I suspect that the detailed comparison of configuration settings is more important than the tutorial video.

1 Like