Skip to content

Performance

Finding silent errors and slow scripts in NetSuite

Alfonso Terron · Software Engineer & Solution Architect
· 6 min read

In short

Silent errors in NetSuite are failures that only leave a trace in the script execution log or in system notes. To find them, keep production deployments off Debug, read the logs before NetSuite purges them, watch governance usage, and let an agent follow the logs live while you test.

Performance · NetSuite

Most NetSuite problems do not announce themselves. A script catches an exception, writes one line to a log nobody reads, and the business runs on bad data for weeks. This guide shows where NetSuite records what your scripts did, how to read it before it disappears, and how an AI agent can read it with you.

What is a silent error in NetSuite, and why does it go unnoticed?

A silent error is a failure that leaves no visible trace for the people using NetSuite: the record saves, the job finishes, the integration reports success, but something did not happen. It goes unnoticed because the only evidence sits in a script execution log, and nobody is looking at it until a customer, an auditor or month-end close finds the gap.

Talk to a NetSuite expert

We build, fix and speed up NetSuite stores and integrations for companies in the US and UK.

The usual sources are the same in almost every account we review:

  • Catch-and-log code. A try/catch that writes log.error and moves on. The record saves; the follow-up step never ran.
  • Background scripts nobody watches. Scheduled and map/reduce scripts run at night, with no user to complain when one fails halfway.
  • User event scripts with side effects. An after-submit script that updates a related record can fail while the record the user edited looks fine.
  • Integrations that retry quietly. A connector that retries a rejected order and gives up produces a log entry, not an alert.

Where does NetSuite record what your scripts did?

Two places matter most: the script execution log and system notes.

The script execution log

Every log.debug, log.audit, log.error and log.emergency call writes an entry at that level. The Log Level field on each script deployment decides which entries are kept. Oracle describes Debug as the level "for scripts in testing mode" and recommends Audit, Error or Emergency for scripts going into production. You can browse entries across all scripts at Customization > Scripting > Script Execution Logs, filtered by log level, execution date range and script name.

The log does not keep everything. Oracle's governance rules for logging say:

  • A company can make up to 100,000 N/log calls across all scripts within a 60-minute period. If a script logs excessively, NetSuite can raise its log level automatically and notify the script owner.
  • User-generated logs are purged after 30 days and system error logs after 60 days.
  • The Execution Log subtab and the server script log search share a limit of 5 million logs per database instance. When it is reached, the logs are purged for every customer on that instance.

What we learned: in a busy production account, volume purges can leave far less than 30 days of history. In one account we found only two to three days of script logs. Chasing an intermittent error? Read the logs the same day.

System notes

System notes answer a different question: who changed this field, and when. Each note captures the date and time, who made the change, the interface it came from, the type of change, the field, and the old and new values. Oracle states that system notes cannot be edited by any user, script or app, and that they are logged on both standard and custom records. On a record, open System Information > System Notes.

Both are queryable. SuiteQL runs through REST web services as a POST to the suiteql resource, and system notes are available through the NetSuite2.com data source. One detail catches people out: without the Administrator role or the System Notes for Analytics and REST permission, you only see system notes for changes you made yourself.

How do you spot an inefficient script?

Every server script runs inside a governance budget measured in usage units. When a script is slow or fails at random, check how close it runs to the limit.

Usage unit limits per script type (Oracle NetSuite Help Center)
Script typeUsage units
User event1,000
Suitelet1,000
RESTlet5,000
Scheduled10,000
Map/reduceNo limit on the full run; each method invocation is governed

Then look for what eats that budget:

  • Searches or record loads inside a loop. One search per line of a 200-line order is 200 searches. Run one search for all the lines instead.
  • Loading the same record more than once in the same execution.
  • Heavy work in user events and Suitelets. Oracle's governance best practices recommend handing high-volume I/O to a scheduled script, and using map/reduce for large data sets, because it yields and reschedules on its own.
  • Gaps between log lines. Two audit entries with timestamps 40 seconds apart tell you exactly which block is slow. Call runtime.getCurrentScript().getRemainingUsage() at checkpoints and log it.
  • Deployments left at Debug in production. They fill the shared log volume, push useful entries out sooner and hide the one error line you need.

How does an AI agent close the loop with an MCP server?

The Model Context Protocol (MCP) is an open-source standard for connecting AI applications to external systems. An AI application, the host, connects to one or more MCP servers, and each server exposes tools the model can call.

Our team built vConnect MCP, an internal MCP server and command-line tool for NetSuite diagnostics. Its read-only server gives the agent:

  • Script logs, filtered by script, level, time window and text, plus a follow mode that streams new log lines as they arrive.
  • A script catalog: scripts, SSP applications, deployments and their log levels.
  • System notes for the field change history of a record.
  • Read-only SuiteQL, limited to SELECT statements.

The follow mode changed how we work. A developer exercises a Suitelet in the browser while the agent follows its logs live and proposes the next change:

  1. Deploy the change to the sandbox.
  2. Exercise it: open the Suitelet, save the record, run the job.
  3. Read: the agent shows the new log lines and the governance used.
  4. Fix, and repeat until the log is clean.

One finding from building it: SSP application logs land in the same execution log, under the web application's script.

A separate write server exists, and it is opt-in. It can only create or edit entries of custom record types whose owner is a VintenCloud employee, runs as a dry run by default, and keeps a local audit log of every change.

What safeguards should a diagnostics tool have?

Giving an agent access to an ERP is a security decision. These are the rules we built in:

  • A read-only role. Authentication uses the OAuth 2.0 client credentials flow, which NetSuite describes as machine-to-machine with no user interaction. Each developer has their own certificate, mapped to a role that can read and nothing else.
  • SELECT-only queries, enforced in code as well as by the role.
  • Redaction and truncation of log details before they reach the model.
  • One request queue per account. Web services and RESTlet requests share an account-level concurrency limit, so a diagnostics tool must never crowd out the integrations that run the business.
  • No client data in tickets or repositories. Log content stays in the session that needed it.

Where should you start?

You can do three things this week without any new tooling:

  1. List your script deployments and their log levels. Move every production deployment off Debug unless someone is actively debugging it.
  2. Search your code for catch blocks that only log. Decide, for each one, whether it should rethrow, alert someone or write to a record a person reviews.
  3. Check how many days of logs your account really keeps, by looking at the oldest entry on the Script Execution Logs page.

If you want a second pair of eyes on a slow or misbehaving account, talk to our NetSuite team.

Frequently asked questions

How long does NetSuite keep script execution logs?
Oracle documents that user-generated logs are purged after 30 days and system error logs after 60 days. The Execution Log subtab and server script log search also share a limit of 5 million logs per database instance, so a busy account can keep far less history in practice.
Which log level should a production script deployment use?
Audit, Error or Emergency. Oracle describes Debug as the level for scripts in testing mode, and Debug logging in production adds volume that pushes useful entries out sooner.
Can I query system notes with SuiteQL?
Yes, through the NetSuite2.com data source. You need the Administrator role or the System Notes for Analytics and REST permission; without them you only see the changes you made yourself.
What is the usage unit limit for a user event script?
1,000 usage units per execution, the same as a Suitelet. Scheduled scripts get 10,000 and RESTlets 5,000. Map/reduce scripts are governed per method invocation instead of per run.
Can an AI agent change data in NetSuite through vConnect MCP?
Not through the diagnostics server, which is read-only. A separate, opt-in write server can only create or edit entries of custom record types owned by a VintenCloud employee, runs as a dry run by default and keeps an audit log.

Sources

  1. Oracle NetSuite Help Center: Setting Script Execution Log Levels (opens in a new tab)
  2. Oracle NetSuite Help Center: Viewing a List of Script Execution Logs (opens in a new tab)
  3. Oracle NetSuite Help Center: Governance on Script Logging (opens in a new tab)
  4. Oracle NetSuite Help Center: System Notes Overview (opens in a new tab)
  5. Oracle NetSuite Help Center: Viewing System Notes Using NetSuite2.com Data Source (opens in a new tab)
  6. Oracle NetSuite Help Center: Using SuiteQL with SuiteTalk REST Web Services (opens in a new tab)
  7. Oracle NetSuite Help Center: Script Type Usage Unit Limits (opens in a new tab)
  8. Oracle NetSuite Help Center: Governance Best Practices (opens in a new tab)
  9. Oracle NetSuite Help Center: OAuth 2.0 Client Credentials Flow (opens in a new tab)
  10. Oracle NetSuite Help Center: Web Services and RESTlet Concurrency Governance (opens in a new tab)
  11. Model Context Protocol: What is MCP? (opens in a new tab)
  12. Model Context Protocol: Architecture overview (opens in a new tab)
Portrait of Alfonso Terron

Alfonso Terron

Software Engineer & Solution Architect

Software engineer and solution architect at VintenCloud, working with NetSuite since 2013.

Alfonso Terron on LinkedIn (opens in a new tab)

Keep reading

  • NetSuite

    When to pair a Next.js front end with NetSuite ERP

    Pair a Next.js front end with NetSuite when your site is mostly content, such as product pages and documentation, and NetSuite already holds customers, orders, licenses and billing. Next.js renders and caches the pages; NetSuite stays the system of record, reached server side through REST web services or RESTlets with OAuth 2.0.

    · 6 min read