Mendix SDK main line not found?

Hi all, I've recently started using the Mendix SDK and I am encountering an issue trying to access the main line. My code is below.   import { domainmodels } from "mendixmodelsdk"; import { MendixPlatformClient} from "mendixplatformsdk"; async function main() { const client = new MendixPlatformClient(); const app = client.getApp("MYAPPID"); const repository = app.getRepository(); const commits = (await repository.getBranchCommits("backup")).items; for (const commit of commits) { console.log(` * ${commit.message}`); } } // Run the 'main' function and report any errors. main().catch(error => { console.log("ERROR: An error occurred.", error); process.exit(1); }) The above code works fine, and gives me a list of the commits in the "backup" branch of my project. However, when I try to change it so that it reads  const commits = (await repository.getBranchCommits("main")).items; to access the main branch, it gives me an error reading  `{"errorCode":"RS400","errorMessage":"Please provide valid input to execute this request. Branch 'branches/main' not found."}` I've tried using "main", "Main line", "MainLine", "Mainline", and a lot of other variations to try and access the main branch, but it keeps giving me the same error that the branch doesn't exist.  Am I using the wrong command if I want to access the main line? Or is there something else?   I am using Mendix 9.24.4, not Mendix 10 and so my code is held in Teamserver, not Git. 
2 answers

Hope these code snippet below help you solve the problem.


const { MendixPlatformClient, Project, OnlineWorkingCopy, Branch } = require('mendixplatformsdk');

const { domainmodels } = require('mendixmodelsdk');


async function main() {

const client = new MendixPlatformClient({  apiKey: 'YOUR_API_KEY' });

const project = new Project(client, 'YOUR_PROJECT_ID', 'YOUR_PROJECT_NAME');

const branch = new Branch(project, 'main');

const workingCopy = await project.createOnlineWorkingCopy(branch);

const domainModel = await loadDomainModel(workingCopy);

await workingCopy.commit();


async function loadDomainModel(workingCopy) {

const dm = await domainmodels.load(workingCopy.model().root);

return dm;



main().catch(error => { console.error("An error occurred", error); });


Ah I've solved this now. The answer was "trunk".

Reading the documentation explains the documentation