The HubSpot CLI is quiet when it works and cryptic when it does not. A deploy that ran fifty times suddenly ends in a forbidden error with no further explanation, a project build fails on a file you did not touch, or an upload lands in a portal you did not mean. None of these is a mystery once you know what the CLI is actually doing under each command, but the error messages rarely say it, and the fix usually sits in a config file or a credential rather than in your code.
In this guide, I will go through the CLI failures that interrupt real deploys, grouped by where they come from: the credential and its scopes, the config file and the account it points at, the project structure the new platform expects, and the build itself. For each, you get the message you will see, what it means, and the fix. It assumes you already have the basics of development on HubSpot Content Hub in place, with a theme, modules and a local workflow. The goal is that the next time the terminal turns red, you recognize the shape of the error before you read the second line.
Part of the guide: HubSpot implementation: the guide and checklist
A forbidden error on upload is a credential problem
The most common CLI failure is a generic forbidden error from hs upload or hs watch, and the message is famously unhelpful. The cause is almost always the credential, not the files. The CLI authenticates with a personal access key, and that key carries the permissions of the user who generated it plus the scopes selected when it was created. If the key lacks the design manager permission, or the scopes a given operation needs, HubSpot answers with a 403 and the CLI passes it along without translation.
The fix is to regenerate the key with the permissions the work requires and re-authenticate with hs account auth, which rewrites the key in your config. Check the user, too: a key generated by a user without the right portal permissions cannot do more than that user can. This is also the error you hit after a client tightens a user's permissions without telling the developer, which is why a 403 that appears out of nowhere on a working project is worth a question to the portal admin before a question to the code.
Missing scopes for functions and secrets
A sharper variant of the credential problem appears when you move beyond themes into functions and secrets. Commands like hs secrets add and project uploads that include serverless functions need scopes on the personal access key that a theme-only key does not have. The error names missing required scopes, and the instinct to look at the project is wrong; the key is the thing that is short. It is a different case from the missing scopes error on the HubSpot API, where the 403 comes from the app's token and not from your personal access key, even though the two messages look alike.
Regenerate the personal access key with the function and secret scopes included, run hs account auth again, and retry. A useful habit is to generate the key with every scope the project will eventually need at the start, rather than discovering each missing one on the day you add a feature. The key is cheap to regenerate; a blocked deploy on a Friday is not.
The upload went to the wrong account
Nothing in the CLI output looks like an error when you upload to the wrong portal. The command succeeds, and the files are now in production when you meant the sandbox. The cause lives in hubspot.config.yml: it holds every account you have authenticated, each with a name, and a default account that commands use when you do not specify one. If the default is production and you forgot the account flag, production is where the upload goes.
Two habits remove this failure. Name the accounts in the config so that production and sandbox cannot be confused, and either set the sandbox as the default or make a rule of always passing the account flag explicitly. Before any upload to a portal you care about, read the account the command will target. The config file makes the target explicit, and the mistake comes from not looking at it.
defaultPortal: client-sandbox portals: - name: client-sandbox portalId: 11111111 authType: personalaccesskey - name: client-production portalId: 22222222 authType: personalaccesskey # always be explicit on anything that matters hs upload ./src theme --account client-production
No hsmeta.json files found
On the current developer platform, where apps and some assets are defined as projects, the CLI expects a specific structure, and hs project upload fails with a message saying no *-hsmeta.json files were found in the current directory when that structure is missing or when you run the command from the wrong folder. The file it is looking for, such as app-hsmeta.json, is the configuration that tells the platform what the project contains.
Check two things. First, that you are running the command from the project root, the folder that holds hsproject.json, not from a subfolder. Second, that the project actually contains the hsmeta files the platform version expects, which differs between a project with an app and a project that holds only serverless functions. Projects built against an older platform version can also trip this, so confirm the platform version in the project configuration matches what the CLI expects.
The build failed on validation
A project build runs validation before anything deploys, and a failure there points at a specific file and rule. The common culprits are a module's fields.json with an invalid field definition, a theme.json or meta.json with a bad value, a missing required key in a configuration file, or a reference to a path that does not exist. The build output names the file and often the line, so the discipline is to read the first error fully before reacting to the ten that cascade from it.
Validate locally where you can before uploading, and fix the first error, then rebuild, rather than trying to fix all of them at once. A cascade of errors usually has one root, and resolving it clears the rest. If the build fails on a file you did not change, look for a dependency you did change, such as a field a module references that was renamed in the theme.
A tip from someone who has been burned: when the CLI turns red, decide which of four things it is before you touch anything: the key, the config, the project structure or the build. A 403 is the key. A wrong portal is the config. A missing hsmeta file is the structure. A named file and rule is the build. Nine times out of ten the fix is in the first two, and neither of them is in your code.
Why this matters for your operation
A CLI error that stops a deploy stops the site from improving, and a CLI mistake that deploys to the wrong portal does worse. A team that reads CLI errors fluently ships without fear, because a red terminal is a five-minute diagnosis instead of an afternoon. A team that does not treats every deploy as a risk and slows down, which is how a site stops evolving.
The patterns here are also the difference between a developer and an operation. One person who knows the fixes is a single point of failure; a team that shares the diagnosis, the key, the config, the structure, the build, can rotate who deploys without the knowledge leaving with them. Documenting the account names and the scopes the key needs is part of that.
In practice: the deploy that worked for one person
A team had a theme only one developer could deploy. Everyone else got a forbidden error from hs upload and assumed the project was somehow tied to that person's machine. The real cause was that the one developer's personal access key had been generated with the design manager permission and the others had not, because they generated their keys with defaults and never selected the scopes.
Each developer regenerated a key with the permissions the project needed, re-authenticated, and the forbidden error disappeared for all of them. The project had never been tied to anyone. The credentials had. A short note in the repository listing the scopes a key needs to work on this project ended the problem for every developer who joined afterward.
Checklist for diagnosing CLI errors
- On a 403 from upload or watch, does the personal access key carry the design manager permission and the scopes the operation needs?
- For functions and secrets, was the key regenerated with the function and secret scopes, followed by hs account auth?
- Are accounts named clearly in hubspot.config.yml, with the default set deliberately and the account flag used for anything that matters?
- On a missing hsmeta error, are you in the project root and does the project contain the hsmeta files its platform version expects?
- On a build failure, did you read the first named error and fix it before the cascade?
- Does the repository document the scopes a key needs, so new developers do not hit the same 403?
Frequently asked questions
Why does hs upload return a forbidden error?
Because the personal access key lacks the permissions or scopes the operation needs, most often the design manager permission. Regenerate the key with the right permissions and run hs account auth again.
I added a scope to my app but the CLI still says scopes are missing. Why?
The CLI authenticates with your personal access key, not the app. Regenerate the key with the scopes the command needs and re-authenticate. For OAuth apps, a new scope also requires reinstalling and re-consenting.
How do I stop uploading to the wrong portal?
Name accounts clearly in hubspot.config.yml, set the default account deliberately, and pass the account flag explicitly on any upload to a portal that matters.
What does "No hsmeta.json files found" mean?
That hs project upload did not find the project configuration files it expects. Run it from the project root and confirm the project contains the hsmeta files for its platform version.
Why does the build fail on a file I did not change?
Usually because of a dependency you did change, such as a renamed field a module references. Read the first validation error fully, because the later ones often cascade from it.
Where should I look first when the CLI fails?
Decide whether it is the key, the config, the project structure or the build. A 403 is the key, a wrong portal is the config, a missing hsmeta file is the structure, and a named file and rule is the build. Most failures are the first two.
Let's talk? Want a HubSpot development workflow where deploys are routine and CLI errors are a five-minute fix? At Insight Sales we set up tooling, credentials and process for CMS teams. Talk to our team and find out how we can help.