UNEXPECTED_ERROR is a generic NetSuite error, so diagnosis depends on the API call, execution context, and input data at runtime. These are recurring causes we see in real support work.
Common SuiteScript Triggers
- Loading a file with an invalid internal ID.
- Using the
N/emailmodule when the author or recipient lacks an email address. - Merging email or PDF templates while passing a JavaScript string instead of a numeric template ID or
RecordRef.
Quick Triage Approach
- Confirm record IDs and parameter types before API calls.
- Validate required fields and related records exist.
- Re-run with narrower scope (single record, smaller batch, or one parameter set) to isolate the failing input.