DIYgod/RSSHub · warning · InvalidParameterError

The database is not exist

Error message

The database is not exist

What it means

InvalidParameterError thrown inside the route's try/catch when the Notion SDK raises an error whose statusCode is APIErrorCode.ObjectNotFound. This means the SDK call (databases.retrieve or databases.query) targeted a database the token cannot see — either the ID is wrong, the database was deleted, or the integration was not given access to it.

Source

Thrown at lib/routes/notion/database.ts:169

                };
            })
        );

        return {
            title: `Notion - ${title}`,
            link,
            description,
            image,
            item: items,
            allowEmpty: true,
        };
    } catch (error) {
        logger.error(error);

        if (isNotionClientError(error)) {
            const { statusCode } = error as any;
            if (statusCode === APIErrorCode.ObjectNotFound) {
                throw new InvalidParameterError('The database is not exist');
            }
            if (statusCode === APIErrorCode.Unauthorized) {
                throw new ConfigNotFoundError('Please check the config of NOTION_TOKEN');
            }
            ctx.throw(statusCode, 'Notion API Error');
        } else {
            ctx.throw(error);
        }
        return null;
    }
}

function parseCustomQuery(queryString) {
    try {
        if (queryString) {
            return JSON.parse(decodeURIComponent(queryString));
        }
    } catch {

View on GitHub (pinned to bed535e087)

Solutions

  1. Open the database in Notion, click ••• → Connections, and add your integration — this is the most common fix.
  2. Verify the databaseId in the route URL matches the 32-char hex ID from the Notion URL (the segment before ?v=).
  3. Confirm the integration was created in the same workspace as the database.
  4. If the database was deleted, the feed cannot work — point the route at an existing database.

Example fix

// before
if (statusCode === APIErrorCode.ObjectNotFound) {
    throw new InvalidParameterError('The database is not exist');
}

// after — clearer message + caller fix
if (statusCode === APIErrorCode.ObjectNotFound) {
    throw new InvalidParameterError(`Database not found or not shared with the integration: ${databaseId}`);
}
// caller: share the DB with the integration in Notion → Connections
Defensive patterns

Strategy: validation

Validate before calling

// Validate the ID shape before calling, and confirm sharing out-of-band.
const NOTION_ID = /^[a-f0-9]{32}$/i;
function validDatabaseId(id) {
  if (!NOTION_ID.test(id)) throw new Error('databaseId must be a 32-char hex string');
  return id;
}

Type guard

const isNotionNotFound = (e: any): boolean =>
  e?.code === 'object_not_found' || e?.status === 404 || e?.statusCode === APIErrorCode.ObjectNotFound;

Try / catch

try { await notion.databases.retrieve({ database_id: id }); }
catch (e) {
  if (isNotionNotFound(e)) {
    // most likely: DB not shared with the integration — guide user to Connections
  } else throw e;
}

Prevention

When it happens

Trigger: Passing a databaseId that does not exist, was deleted, or — most commonly — exists but was not shared with the integration whose NOTION_TOKEN is configured. The SDK returns 404 ObjectNotFound and the route converts it to InvalidParameterError.

Common situations: User copies a database URL/ID from a Notion page they can view in the browser, but forget that the integration is a separate principal that must be explicitly added; database moved to a workspace the integration cannot access; ID typo.

Related errors


AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12). Data as JSON: /api/errors/bf288a5e074cf6e5. Report an issue: GitHub.