LWC1503: @wire decorator's parameter must be a function
The compiler caught an `@wire` usage where the first argument isn't an Apex method, a Lightning Data Service module, or a wire adapter — usually because of a missing import, a wrong import path, or a stray comma.
Also seen asLWC1503·@wire decorator's parameter·LWC1503: @wire decorator·wire decorator must be a function
LWC's compile-time errors are clearer than Aura's, and LWC1503 is one of the friendliest: the wire's first argument has to be a recognised wire adapter at compile time, or the build refuses to ship.
What @wire actually expects
import { LightningElement, wire } from 'lwc';
import getAccounts from '@salesforce/apex/AccountController.getAccounts';
export default class MyComponent extends LightningElement {
@wire(getAccounts) accounts; // ✅ direct method reference
@wire(getAccounts, { name: 'Acme' }) filtered; // ✅ method + reactive params
}
The first arg has to be a value the compiler recognises as a wire adapter — either an @salesforce/apex/... import or one of the built-in adapters (getRecord, getObjectInfo, etc.).
Common causes of LWC1503
1. The import path doesn't resolve
import getAccounts from '@salesforce/apex/AccountController.getAccount'; // typo
@wire(getAccounts) accounts;
If the Apex method name doesn't match exactly (case-sensitive, full method name), the import becomes undefined and the @wire errors out. Cross-check the Apex class:
public with sharing class AccountController {
@AuraEnabled(cacheable=true)
public static List<Account> getAccounts() { ... }
}
The method must be @AuraEnabled and cacheable=true for @wire. Without those, the import won't work.
2. Import is a default-vs-named confusion
The Apex bridge uses default imports:
import getAccounts from '@salesforce/apex/AccountController.getAccounts'; // ✅
import { getAccounts } from '@salesforce/apex/AccountController.getAccounts'; // ❌ undefined
LDS adapters are named imports:
import { getRecord } from 'lightning/uiRecordApi'; // ✅
import getRecord from 'lightning/uiRecordApi'; // ❌ undefined
If you have the wrong shape, the symbol resolves to undefined and @wire(undefined) fails.
3. Conditionally-built wire reference
const adapter = condition ? getAccounts : null;
@wire(adapter) accounts; // ❌ LWC1503
The compiler resolves @wire decorators at build time. The argument can't depend on runtime branching. If you need conditional wiring, use the imperative form:
import getAccounts from '@salesforce/apex/AccountController.getAccounts';
handleClick() {
getAccounts({ name: 'Acme' })
.then(rows => { this.accounts = rows; })
.catch(err => { this.error = err; });
}
4. Apex method isn't cacheable=true
For @wire (not imperative), Apex must declare cacheable=true:
@AuraEnabled(cacheable=true)
public static List<Account> getAccounts() { ... }
Without it, the @wire adapter throws at compile time. cacheable=true means no DML — the method must be a pure read. If you need to write, use imperative invocation instead.
Reading the LWC compiler output
The error includes a file path and line. Open the file at that line; the offending decorator is right there. If your editor has the LWC extension installed (VS Code recommended), most LWC1xxx errors appear as red squigglies before you even build.
