ZPLToolkit

Limits and alternatives

“Maximum label count exceeded” when rendering ZPL

This one is about the file, not the account: a single request carried more ^XA…^XZ pairs than the service renders at once. How to find out how many your file has, and how to split it.

What the error is counting

Unlike a rate limit or a quota, this error is about one request. A rendering service caps how many labels it will draw in a single call, and the file you sent held more than that.

The count is the number of complete formats in the file. Every ^XA opens one and every ^XZ closes it, so a file with fifty pairs is fifty labels however long or short each one is.

^XA
^FO50,50^A0N,40,40^FDLabel one^FS
^XZ
^XA
^FO50,50^A0N,40,40^FDLabel two^FS
^XZ
Two labels in one file: two ^XA…^XZ pairs, counted as two.

Count them before you send

The quickest check is to count occurrences of ^XZ in the file — one per complete label. If that count and the count of ^XA disagree, you have a different problem: a format somewhere is unbalanced, and the renderer will be counting something other than what you think.

An unclosed ^XA is worth ruling out first, because it changes the count and because it is a real bug. A printer fed a format that never closes sits waiting for the rest of it, which is one of the classic causes of a label that never comes out.

Pasting the file into the validator on this site reports unbalanced formats with the line and column of the offending command, and the viewer pages through the labels it found — which is the same count the rendering service is applying.

Splitting the file

Split on the boundary between formats — after an ^XZ, before the next ^XA — and never in the middle of one. A chunk that starts partway through a format is not a valid label, and the error you get back from that is considerably more confusing than the one you started with.

If the file is a batch you produced, it is usually easier to emit it in chunks than to split it afterwards. If it came from somewhere else, splitting on ^XZ is reliable as long as no ^FD field contains that text — which it can, so check before trusting a naive split.

A local renderer sidesteps the limit rather than working around it: there is no per-request cap because there is no request. The viewer on this site pages through however many labels the file holds, and the PDF export writes them all to one document.

Open ZPL to PDF

Render a multi-label file in the browser, with no cap on how many formats it holds, and export one page per label.

Open ZPL to PDF

Common questions

How many labels are in my file?
As many as it has ^XZ commands, assuming each one closes an ^XA. If the two counts differ, fix the unbalanced format first — that is a bug in the file, not just a counting problem.
Can I split a label across two requests?
No. A format has to arrive complete, from ^XA to ^XZ. Split between labels, never inside one.
Does a ~DG graphic download count as a label?
No. Tilde commands sit outside ^XA…^XZ and are instructions to the printer rather than labels. They do have to travel with the file that uses them, though — a ^XG recalling a graphic that was never downloaded draws nothing.

Commands in this guide

Related guides