Could not parse key 'null'

Hello, I am trying to create a Plan in Bamboo using specs but I everytime get the following error message:

 

[ERROR] Failed to execute goal com.atlassian.bamboo:bamboo-specs-runner:6.1.1:run (default-cli) on project bamboo-specs-tutorial: Execution default-cli of goal com.atlassian.bamboo:bamboo-specs-runner:6.1.1:run failed: java.lang.reflect.InvocationTargetException: An error occurred while publishing plan DEVOPS-TST: Could not parse key 'null' -> [Help 1]


 

and here the snippet of code:

 

public static void main(final String[] args) throws Exception {
BambooServer bambooServer = new BambooServer("https://bamboo.foo.com/bamboo");
Plan plan = new PlanSpec().createPlan();
bambooServer.publish(plan);
}

Project project() {
return new Project().key("DEVOPS");
}

Plan createPlan() {
return new Plan(
project(),
"TEST SPECS", "TST")
.description("Plan created from (enter repository url of your plan)");
}


Activating some TRACE logs I see the post that is

2017-10-23 11:44:34,425 INFO [BambooServer] Publishing plan DEVOPS-TST
2017-10-23 11:44:34,533 TRACE [RestHelper] Sending the following content to https://bamboo.foo.com/bamboo/rest/api/latest/import/plan via POST:
--- !!com.atlassian.bamboo.specs.util.BambooSpecProperties
rootEntity: !!com.atlassian.bamboo.specs.api.model.plan.PlanProperties
description: Plan created from (enter repository url of your plan)
enabled: true
key:
key: TST
name: TEST SPECS
oid: null
pluginConfigurations: []
dependenciesProperties:
childPlans: []
dependenciesConfigurationProperties:
blockingStrategy: NONE
enabledForBranches: true
requireAllStagesPassing: false
notifications: []
planBranchManagementProperties:
branchIntegrationProperties:
enabled: false
gatekeeper: false
integrationBranch: null
pushOn: false
createPlanBranch:
matchingPattern: null
trigger: MANUAL
deletePlanBranch:
removeDeletedFromRepository: false
removeDeletedFromRepositoryPeriod: !!java.time.Duration 'PT0S'
removeInactiveInRepository: false
removeInactiveInRepositoryPeriod: !!java.time.Duration 'PT0S'
issueLinkingEnabled: true
notificationStrategy: NONE
triggeringOption: INHERITED
project:
description: null
key:
key: DEVOPS
name: null
oid: null
repositories: []
repositoryStoredSpecsData: null
stages: []
triggers: []
variables: []
specModelVersion: 6.1.1 

 
Am I missing anything here?

1 answer

In general, the best idea is to define a plan in Bamboo UI and then export it to Bamboo Specs source code in Actions -> Configure Plan -> View plan as Bamboo Specs as described here.

Hope you have figured out the issue by now.

Hi,

I'm seeing an equally vague error when I take a job spec from a bamboo server and run the code. 


2018-09-26 15:24:58,704 INFO [BambooServer] Publishing plan CT-ING
2018-09-26 15:24:59,621 INFO [BambooServer] An error occurred while publishing plan CT-ING: Could not parse key 'null'
2018-09-26 15:24:59,621 DEBUG [BambooServer] {"message":"Could not parse key 'null'","status-code":400}
Exception in thread "main" com.atlassian.bamboo.specs.api.exceptions.BambooSpecsPublishingException: An error occurred while publishing plan CT-ING: Could not parse key 'null'
at com.atlassian.bamboo.specs.util.BambooServer.translateRestException(BambooServer.java:170)
at com.atlassian.bamboo.specs.util.BambooServer.translateException(BambooServer.java:140)
at com.atlassian.bamboo.specs.util.BambooServer.publish(BambooServer.java:97)
at org.iop.iopsci.bamboo.MyPlanSpec.main(MyPlanSpec.java:207)
Caused by: com.atlassian.bamboo.specs.exceptions.BambooSpecsRestRequestException: Could not parse key 'null'
at com.atlassian.bamboo.specs.util.RestHelper.lambda$sendRequest$2(RestHelper.java:89)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:222)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:164)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:139)
at com.atlassian.bamboo.specs.util.RestHelper.sendRequest(RestHelper.java:92)
at com.atlassian.bamboo.specs.util.RestHelper.post(RestHelper.java:201)
at com.atlassian.bamboo.specs.util.SendQueue$1.run(SendQueue.java:23)

 The server doesn't seem to produce much useful logging:

2018-09-26 15:27:52,463 INFO [http-nio-8085-exec-24] [BambooAuthenticator] Finished doing authentication checks for user, took 100.4 ms

2018-09-26 15:27:52,469 INFO [http-nio-8085-exec-24] [AccessLogFilter] user POST https://test-bamboo.iop.org/rest/api/latest/import/plan 415220kb

2018-09-26 15:27:52,597 INFO [http-nio-8085-exec-24] [HungBuildPlanConfigurationPlugin] setting default values for edit page. custom.com.atlassian.bamboo.plugin.hungbuildkiller.hung.enabled

 Is there any way of getting the server to produce detailed output to help pin down the issue?

Could this be a bug in Bamboo 6.6.2?

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted an hour ago in Statuspage

How do your teams prepare for really high (planned) traffic days like Cyber Monday?

Hi there! Shannon from Statuspage here.  👋  With Cyber Monday quickly approaching, we're looking to hear from Atlassian customers – specifically from teams who touch incident response li...

8 views 0 2
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you