java.lang.IllegalStateException: cannot create a build with number 1 since that (or higher) is already in use among [32]

Jenkins JIRA | Lee Winder | 5 months ago
  1. 0

    I am using the Jenkins CLI jar to recreate projects based on a tempate project. The process is as follows * Calls 'get-job' to check if the job exists * If job exists calls 'delete-job' to remove the project * Calls 'create-job' to create the project (using the same job name as the one deleted) 'create-job' simply uses the XML job description from the template job with various properties altered (job name, env variables etc.). The issue seems to occur if the job already exists and has been run multiple times before being deleted and recreated. So, if the job is initially created and runs 32 times before being deleted and recreated, the next time this (new) job is run, it generates this error java.lang.IllegalStateException: cannot create a build with number 1 since that (or higher) is already in use among [32] at jenkins.model.lazy.AbstractLazyLoadRunMap.proposeNewNumber(AbstractLazyLoadRunMap.java:373) at hudson.model.RunMap.put(RunMap.java:191) at jenkins.model.lazy.LazyBuildMixIn.newBuild(LazyBuildMixIn.java:176) at hudson.model.AbstractProject.newBuild(AbstractProject.java:1018) at hudson.model.AbstractProject.createExecutable(AbstractProject.java:1209) at hudson.model.AbstractProject.createExecutable(AbstractProject.java:144) at hudson.model.Executor$1.call(Executor.java:364) at hudson.model.Executor$1.call(Executor.java:346) at hudson.model.Queue._withLock(Queue.java:1371) at hudson.model.Queue.withLock(Queue.java:1232) at hudson.model.Executor.run(Executor.java:346) This will continue to happen until we run the new job 33 times, at which point the build number is >32 and the job can successfully start. As the job is deleted, I would expect the cached build number to have been deleted also.

    Jenkins JIRA | 5 months ago | Lee Winder
    java.lang.IllegalStateException: cannot create a build with number 1 since that (or higher) is already in use among [32]
  2. 0

    [JENKINS-26739] ISE from AbstractLazyLoadRunMap.proposeNewNumber for concurrent matrix builds - Jenkins JIRA

    jenkins-ci.org | 2 months ago
    java.lang.IllegalStateException: cannot create a build with number 2322 since that (or higher) is already in use among [2261, 2262, 2263, 2264, 2265, 2266, 2267, 2268, 2269, 2270, 2271, 2272, 2273, 2274, 2275, 2276, 2277, 2278, 2279, 2280, 2281, 2282, 2283, 2284, 2285, 2286, 2287, 2288, 2289, 2290, 2291, 2292, 2293, 2294, 2295, 2296, 2297, 2298, 2299, 2300, 2301, 2302, 2303, 2304, 2305, 2306, 2307, 2308, 2309, 2310, 2457, 2458, 2459, 2460, 2461, 2462, 2463, 2464, 2465, 2466, 2467, 2468, 2469, 2470, 2471, 2472, 2473, 2474, 2475, 2476, 2477, 2478, 2479, 2480, 2481, 2482, 2483, 2484, 2485, 2486, 2487, 2488, 2489, 2490, 2491, 2492, 2493, 2494, 2495, 2496, 2497, 2498, 2499, 2500, 2501, 2502, 2503, 2504, 2505, 2506]
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

    1 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalStateException

      cannot create a build with number 1 since that (or higher) is already in use among [32]

      at jenkins.model.lazy.AbstractLazyLoadRunMap.proposeNewNumber()
    2. jenkins.model.lazy
      AbstractLazyLoadRunMap.proposeNewNumber
      1. jenkins.model.lazy.AbstractLazyLoadRunMap.proposeNewNumber(AbstractLazyLoadRunMap.java:373)
      1 frame
    3. Hudson
      RunMap.put
      1. hudson.model.RunMap.put(RunMap.java:191)
      1 frame
    4. jenkins.model.lazy
      LazyBuildMixIn.newBuild
      1. jenkins.model.lazy.LazyBuildMixIn.newBuild(LazyBuildMixIn.java:176)
      1 frame
    5. Hudson
      Executor.run
      1. hudson.model.AbstractProject.newBuild(AbstractProject.java:1018)
      2. hudson.model.AbstractProject.createExecutable(AbstractProject.java:1209)
      3. hudson.model.AbstractProject.createExecutable(AbstractProject.java:144)
      4. hudson.model.Executor$1.call(Executor.java:364)
      5. hudson.model.Executor$1.call(Executor.java:346)
      6. hudson.model.Queue._withLock(Queue.java:1371)
      7. hudson.model.Queue.withLock(Queue.java:1232)
      8. hudson.model.Executor.run(Executor.java:346)
      8 frames