Hi,
I have a project linked to a git repository and everyting was working as it should.
But if I try to add some Runbook in this project, I get the following error:
Git repository error
There was an error retrieving the variables from the Git repository. The runbook can not be published until the error is resolved.
There was a problem with your request.
Branch has not been initialized
the stacktrace starts like this:
Unhandled error on request: "Branch has not been initialized" Octopus.Core.Git.Schema.Exceptions.GitSchemaException: Branch has not been initialized
at Octopus.Core.Git.Transactions.GitDocumentTransaction.MigrateBeforeExecute[T](Func`1 innerOperation, CancellationToken cancellationToken) in ./source/Octopus.Core/Git/Transactions/GitDocumentTransaction.cs:line 215
at Octopus.Core.Git.Transactions.GitDocumentTransaction.GetDocumentOrNull[T](String fileName, CancellationToken cancellationToken) in ./source/Octopus.Core/Git/Transactions/GitDocumentTransaction.cs:line 68
at Octopus.Core.Persistence.Git.GitDocumentStore`2.GetOrNull(TKey id, CancellationToken cancellationToken) in ./source/Octopus.Core/Persistence/Git/GitDocumentStore.cs:line 123
at Octopus.Core.Persistence.Database.ProjectPathDecorators.ProjectPathDocumentStoreDecorator`2.GetOrNull(TKey id, CancellationToken cancellationToken) in ./source/Octopus.Core/Persistence/Database/ProjectPathDecorators/ProjectPathDocumentStoreDecorator.cs:line 39
Any idea how to fix this ?
My Octopus Server verstion is: v2023.1 (Build 9794)
Hi @julien.tognazzi
At the moment, Runbooks are not supported under Configuration as Code projects. We do have it under consideration in our roadmap though, so if you wish to express interest at this link it will help our product team determine what to put in next for our workload.
Let me know if you have any other questions off the back of this.
Kind Regards
Sean
Does it means that under Configuration as Code project one cannot use the runbook feature ?
I don’t think so, because I have other projects under Configuration as Code and there the runbook feature is working.
So how can I fix my issue ?
Hi @julien.tognazzi
Apologies, I misunderstood the overall request here. You can use your runbooks, but they are currently not stored in code like your standard process deployment. I can see you’re just having a general issue using the runbook itself.
For this error there is usually a problem with a required OCL file missing. In this case, it may be the variables.ocl
file. Would you be able to send me a screenshot of your current repository and what OCL files are contained within there?
Kind Regards
Sean
Ok, so here is the content of the .octopus folder:
we have already 2 projects there, and the problem I have is with a new project (kafka) which is not yet merged in main, so it is still just a feature branch

Can this be the cause of my issue ?
Problem solved !
After I merged the new project on the main branch, I could use the runbook feature.
But still looks like a bug to me…
Hi @julien.tognazzi
Glad to hear that you solved it. If your feature branch for kafka had the variables.ocl file in, but this wasn’t in the main branch that your runbook was trying to use then this would have been the issue. After merging the file in the variables can be accessed by the runbooks and continue working.
Let me know if you run into any other issues!
Kind Regards
Sean
Hi Sean,
thanks for the explanation.
So does it means the runbook can only use variables already defined in main ?
Any variables only defined in a feature branch won’t be defined until merged in main ?
Regards,
Julien
Hi @julien.tognazzi
You can use variables in another branch, but you must be switched to that particular branch to be able to use them. If you are currently using “main” then you will only have access to variables in there, and vice verse.
Kind Regards
1 Like