Jenkins workspace missing error

Hi Team,
Came across below error for few Jenkins jobs:


Error: no workspace

There’s no workspace for this project. Possible reasons are:

  1. The project was renamed recently and no build was done under the new name.
  2. The agent this project has run on for the last time was removed.
  3. The workspace directory (null) is removed outside Jenkins.
  4. The workspace was wiped out and no build has been done since then.

Run a build to have Jenkins create a workspace


Upon investigating came across that, there some schedule clean is captured under Manage Jenkins > System Log > All Jenkins logs as indicated below image:

When i checked for the workspace inside the Jenkins agent/agent where jobs ran, the workspace exists.

Note that when i build the jenkins job again and is completed, i can see the workspace. But, cannot keep on building the job for multiple times and oftenly for this issue.

Just want to know, what is this causing the workspace to be missing. Is there any configurations to disable to avoid this issue or preserve the workspace.

Regards,
Azeem

Jenkins will remove workspaces that haven’t changed since 30 days. This is determined by looking at the timestamp of the workspace folder.
You can set hudson.model.WorkspaceCleanupThread.disabled=true via the script console to disable this cleaning.
Use -Dhudson.model.WorkspaceCleanupThread.disabled=true as an argument to your jvm running Jenkins to disable it permanently.

What you see in the screenshot is not cleaning workspaces, this is cleaning some cache from the parameterized remote trigger plugin.

Got it,
Thanks a lot for the clarification