Branch deploy failing to use branchname for url

We have branch deploys set up and for the most part they are working amazingly.

Sometimes, though, the deploy fails to use the branch name and instead use what i have to assume is the branch id (it matches the url /deploys/deployId) which means we can see it, but it changes with each push to the branch.

We tried to figure out what was causing this… if it’s branch names with slashes, or branch names that are longer than a certain length… but we really aren’t sure.

This might be a bug, but it would be nice to figure out some way of stopping this because having a reliable link from the PR description to the deploy is like candy heaven kitten rainbows

example deploy id: 5e94d41524db1900072ab63b

Hi, @thedamon, and welcome to the Netlify community site.

The length of the branch name is causing this issue. Long branch names cause a limit with the DNS specification to be reached.

There limit in question is the max length of a “label” as defined here:


labels 63 octets or less

An “octet” is a single character for all practical purposes in this case. A “label” is any string between or before a literal . character in a domain name.

Taking, this domain name as the example:

There are four labels above:

  • foo of length 3
  • bar of length 3
  • example of length 7
  • com of length 3

No one label can be longer than 63 characters. This is part of the specification for domain names (and not a limit being created by Netlify).

I believe this site name for the deploy above is 17 characters long.

Our systems always add two “-” characters between the branch name and the site name. So, this total length is 19 characters which leaves a remaining 44 character maximum length for branch names.

The branch name for that branch is 54 characters so the defined label is invalid and cannot be used. If a branch name is longer than 44 characters, the branch subdomain for the branch cannot be used.

Note, that max branch name length is dependent on the length of the site subdomain. If the site name was only 5 characters long, the max branch length would be 56 (which is 63 - 5 - 2). With a five character site name, this branch subdomain would the work like other branch subdomains.

If there are other questions about this, please let us know.


I just found this thread because I hit the same problem, I guessed it had something to do with the ‘subdomain’ char limit so I thought I’d check to see if anyone has hit the same problem with Netlify, and… well, now you’re reading this.

My question - if this is an unavoidable issue, why not just prevent the branch deploy URL from being too long? Since (apart from guessing based on previous branch deploy names) we as users don’t know what the branch deploy URL is until the branch is deployed, does it matter if the branch name is truncated?

Hi, @ollyskinner. While I don’t know exactly why this issue isn’t handled by truncating the branch name, I can make an educated guess.

The current feature works on a 1:1 match of the branch name (once it has be “slugfied”). If we truncated the branch name, there would no longer be a 1:1 connection between the branch subdomain and the branch name. Connecting a branch subdomain to a branch would then require some additional logic to join the two.

In other words, this small change would likely require an additional layer of logic to connect the now truncated names with the original name. While that may sound like something trivial to implement, the reality is quite the opposite. This additional logic would need to be introduced without breaking any additional functionality or any of the sites already deployed.

Also, in attempting to route around the cases where a branch name is too long, we now need to also solve a number of additional edge case issues. For example, let’s imagine we truncate the two the branches new-features/add-tracking-for-users and new-features/add-tracking-for-accounts both to new-features-add-tracking-for. Now two branches both use the same subdomain of Which one is the correct one? How do you know which of the two branches that subdomain actually points to. Meaning, attempting to truncate now creates a whole new class of errors to avoid - like two branches have a truncated name collision. Any solution will also need to solve the new problems what will arise if we start to truncate.

Again, I’m hoping this clarifies why what might seem easy in theory is actually quite complex to implement.

So, because the issue is actually quite complex to solve, we don’t attempt to solve it at all and simply fail when the branch name is too long.

We can enter a feature request for some way of handling the “too long” names but if or when such a feature might get added will be based on the number of requests for the new feature. As you are only the second person to ask about it, it would stand to reason that creating the feature isn’t likely to happen soon.

If there are other questions about this, please let us know.

@luke Thanks for all that - after I posted it did occur to me the case of clashing branch names that you’ve illustrated! But it all makes sense - perhaps this is just an issue of UX, some kind of simple indication on/under the ‘branch deploys’ input field that any too-long branch name will fail? But like you say, it seems in general your users aren’t quite as loquacious as myself and the OP…

Hi, @ollyskinner. We’ve filed a feature request for this and if it becomes available we will post an update here to let you know.