HeyPuter/puter · error · HttpError
bad_request
bad_request
Error message
Missing or invalid `object`
What it means
NotificationDriver.create() requires an `object` argument that is an object (the notification envelope, with the payload under object.value). Missing, null, or non-object input is rejected. This method is intended for server-internal callers pushing notifications, not end-user apps.
Source
Thrown at src/backend/drivers/notification/NotificationDriver.ts:89
},
};
readonly concurrent: DriverConcurrentConfig = {
default: {
limit: 20,
bySubscription: {
[DEFAULT_FREE_SUBSCRIPTION]: 10,
[DEFAULT_TEMP_SUBSCRIPTION]: 5,
},
},
};
// -- Driver methods ----------------------------------------------
async create(args: Record<string, unknown>): Promise<unknown> {
const object = args.object as Record<string, unknown> | undefined;
if (!object || typeof object !== 'object') {
throw new HttpError(400, 'Missing or invalid `object`', {
legacyCode: 'bad_request',
});
}
const actor = this.#requireUserActor();
const value = object.value ?? {};
const created = await this.stores.notification.create({
userId: actor.user.id,
value,
});
return this.#toClient(created);
}
async read(args: Record<string, unknown>): Promise<unknown> {
const actor = this.#requireUserActor();
const uid = (args.uid ?? args.id) as string | undefined;
if (!uid)
throw new HttpError(400, 'Missing `uid`', {View on GitHub (pinned to 908ec23eda)
Solutions
- Wrap the notification payload: { object: { value: { ... } } }.
- Ensure object is a non-null object before the call.
Example fix
// before
await notifications.create({ text: 'hi' });
// after
await notifications.create({ object: { value: { text: 'hi' } } }); Defensive patterns
Strategy: validation
Validate before calling
if (!object || typeof object !== 'object') {
throw new TypeError('notifications.create requires an object envelope');
}
await notifications.create({ object }); Type guard
const isNotificationObject = (v: unknown): v is Record<string, unknown> => typeof v === 'object' && v !== null;
Prevention
- Wrap payloads: { object: { value: { ... } } }.
- Remember create is server-internal; use the correct caller context.
When it happens
Trigger: Calling /drivers/call on puter-notifications create with { } and no object key; passing a bare string payload; passing object: null.
Common situations: Shaping the driver/call payload wrong (passing value directly instead of wrapped in object); migrating from a flat payload to the object envelope; internal service forgetting the wrapper.
Related errors
AI-assisted analysis of HeyPuter/puter@908ec23eda (2026-08-12).
Data as JSON: /api/errors/97d9f1589db4d71a.
Report an issue: GitHub.