## TL;DR

The location on a bill line must be valid for the bill's subsidiary; imports fail when the location key is wrong or belongs to another subsidiary. Validate each line's location against the subsidiary's location list before import, and default the location from the vendor or subsidiary when the invoice does not specify one.

## Error

```text
Invalid location reference key 12 for subsidiary 3
```

## Steps

1. List valid locations for the bill's subsidiary.
   Expected: The allowed set.
2. Map the invoice's ship-to or cost center to a valid location.
   Expected: A defensible location per line.
3. Replace invalid keys in the import file.
   Expected: Clean references.
4. Re-run the import.
   Expected: Accepted lines.
5. Add a pre-import validation step for location keys.
   Expected: The error stops recurring.

## When to use

- Vendor bill imports fail on location references
- Multi-location subsidiaries
- Migrating bills with location data

## When not to use

- Subsidiary or department key errors
- UI-entered bills
- Non-NetSuite ERPs

## Compatibility

NetSuite CSV import, SuiteTalk, REST API.

## Variant phrasings

### invalid location reference key

### NetSuite location key vendor bill

### location subsidiary mismatch bill

## Root cause

Locations are subsidiary-scoped in NetSuite. An import carrying a location from another subsidiary, or a stale internal ID, fails reference validation on every affected line.

## Edge cases

- Some subsidiaries share location names with different internal IDs; match by subsidiary plus name
- Intercompany bills need the location valid on both sides
- Inactive locations fail the same way; check status, not just existence

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_ybzsp-QW_T-deObEe-vVsA
