Resources / Article

NetSuite usage limit exceeded: SSS_USAGE_LIMIT_EXCEEDED

SSS_USAGE_LIMIT_EXCEEDED means a script ran out of governance units. Check remaining usage, split the run, or move to Map/Reduce.

NetSuite stops a script once it burns through more governance units than its script type permits (SuiteScript Governance and Limits). The error appears when a script passes the units its type allows, and NetSuite terminates the run at that point.

"Netsuite USAGE_LIMIT_EXCEEDED error on suitelet" (Stack Overflow)

What does SSS_USAGE_LIMIT_EXCEEDED mean?

Governance runs on usage units, and a script that goes past its allowance is terminated (SuiteScript Governance and Limits). The same mechanism catches runaway behaviour such as an endless loop and halts the script (SuiteScript FAQ).

NetSuite tracks units against two things: the script type and the individual API (SuiteScript Governance and Limits). When the error appears, execution has been terminated, so the records after that point were never processed.

How NetSuite counts governance units

Start with the script type. A scheduled script gets 10,000 units for the whole run, counting every action it takes (Script Type Usage Unit Limits). A RESTlet gets 5,000 units, counted at two levels, the script and the API. A mass update script gets 1,000 units for each record it touches. A portlet script gets 1,000 units.

Then the API cost. NetSuite prices the work by record category: a custom record, a standard transaction, or a standard record that is not a transaction (SuiteScript 2.1 API Governance). A custom record costs fewer units than a standard record. Standard non-transaction records cost less than standard transaction records. The API governance page carries the unit table for SuiteScript 2.1 methods. Oracle lists record.load at 10 units for a transaction record, 2 for a custom record and 5 for any other record, and Record.save at 20, 4 and 10. record.create and record.submitFields cost the same as record.load.

How to check remaining governance units

Script.getRemainingUsage() tells the running script how many units it still has (SuiteScript 2.1 API Governance). Call it before a heavy block of work and compare the answer with what you expect that block to spend.

Logging has its own governance. The governance index lists Governance on Script Logging and Monitoring Script Usage as separate topics (SuiteScript Governance and Limits index).

How to reschedule a script that runs out of units

For a SuiteScript 1.0 scheduled script, write a checker that reads the units left and yields once the figure drops low (Governance Best Practices). A yield marks a recovery point and books the script to finish in a later run, so the job handles part of the data now and the remainder afterwards. SuiteScript 2.x offers no equivalent for a scheduled script. With 2.x, lower the record count per run and submit the script again for the next batch.

When to move the work to a Map/Reduce script

Use Map/Reduce when a scheduled script cannot finish the record count in one run. A SuiteScript 2.x Map/Reduce script yields on its own, and you submit it the way you submit a scheduled script (Governance Best Practices). Two size limits apply inside mapContext.write() and reduceContext.write(): a key can hold up to 3,000 characters and a value up to 10 MB (SuiteScript Governance and Limits). Go past either and the run fails with KEY_LENGTH_IS_OVER_3000_BYTES or VALUE_LENGTH_IS_OVER_10_MB. Keep generated key strings short.

Example

A distributor in Pune runs a scheduled script that loads each of 4,000 item records and creates a month-end stock adjustment journal for it. Per Oracle's table, loading an item costs 5 units, because an item is a standard non-transaction record. Creating the journal costs 10 units and saving it costs 20, because a journal is a standard transaction. That is 35 units per item. A scheduled script has 10,000 units for the run (Script Type Usage Unit Limits), and 10,000 divided by 35 is 285 items. The run stops after item 285, and the remaining 3,715 items are left unadjusted. At an average item value of INR 4,500, that is about INR 1.67 crore of stock value sitting outside the adjustment.

Two ways out. Add a checker that stops the run when 2,000 units remain, then submit the script again for the leftover records. Or rebuild the job as Map/Reduce, where the map stage emits one key per item and the reduce stage writes the journal. If the item list is spread across warehouses, the same design questions come up as in multi-location inventory.

Governance units: why the run stops after 285 itemsEach item costs 5 units to load, 10 to create the journal and 20 to save it, 35 in all. A scheduled script has 10,000 units for the run, and 10,000 divided by 35 is 285 items. Of 4,000 items, 285 are processed and 3,715 are left unadjusted.Load item: 5unitsCreatejournal: 10units+Save journal:20 units+35 units per item. A scheduled script has 10,000units for the run: 10,000 / 35 = 285 items4,000 item recordsSolid: 285 items done. Dashed: 3,715 items leftunadjusted
Why a scheduled script runs out of governance units after item 285 of 4,000.

Trade-offs

Splitting a run into batches means more submissions and more partial states to reason about. Each batch has to be safe to run twice, because a resubmission can overlap with a run that is still finishing.

Map/Reduce yields without any help from you (Governance Best Practices). Key and value size limits still apply, and a long generated key fails the run (SuiteScript Governance and Limits).

A remaining-units check costs a call each time you use it. Place the check before a heavy block of work so it runs once for that block.

Common mistakes

Reading the error as a data problem. The error reports the unit budget, so change how the work is split.

Assuming a SuiteScript 2.x scheduled script resumes where it stopped. That script type has no recovery point method (Governance Best Practices).

Sizing the run from a small test. Measure the unit cost per record on a full-size batch before you deploy.

Ignoring key length in Map/Reduce until the run fails with KEY_LENGTH_IS_OVER_3000_BYTES (SuiteScript Governance and Limits).

Writing the unit budget into the build only after go-live. Put the per-run record count and the expected unit cost in the BRD so the limit is a design input.

FAQ

Does the limit reset on each run?
The published limits apply to the execution (Script Type Usage Unit Limits). A fresh submission starts with the allowance for that script type.

Can I raise the limit?
Change how the work is split, or run it under a script type with a higher limit (Script Type Usage Unit Limits).

What limits apply in the reduce stage?
A key can hold up to 3,000 characters and a value up to 10 MB in reduceContext.write() (SuiteScript Governance and Limits). Go past either and the run fails with KEY_LENGTH_IS_OVER_3000_BYTES or VALUE_LENGTH_IS_OVER_10_MB.

Does SuiteScript 2.x have a yield for scheduled scripts?
No. SuiteScript 2.x has no method to set recovery points or yield for a scheduled script (Governance Best Practices). Map/Reduce scripts yield on their own.

How do I see how many units a run used?
Monitoring Script Usage and Governance on Script Logging are listed as separate topics in the governance index (SuiteScript Governance and Limits index).

The quick way is mark.: it reads the client's NetSuite account read only, finds the script behind the error and tells you the exact fix. Try it free.

Sources

  1. docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/chapter_N3350651.html
  2. docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/chapter_N3917921.html
  3. docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_157072844224.html
  4. docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_164314457772.html
  5. docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_N3351480.html
  6. docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/set_N2807372.html

Have mark. check this against the client's own files

mark. reads the client's files and sets each point against them, with the source beside it.

Book a working session

Twenty minutes on one client folder. Your 21-day trial opens on the call.

Start your free trial

Three questions, and Mark opens an account for you on NetSuite.

Which ERP do your clients run?

Your account opens within one working day.