{"record":{"id":"bf288a5e074cf6e5","repo":"DIYgod/RSSHub","slug":"the-database-is-not-exist","errorCode":null,"errorMessage":"The database is not exist","messagePattern":"The database is not exist","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":503,"severity":"warning","filePath":"lib/routes/notion/database.ts","lineNumber":169,"sourceCode":"                };\n            })\n        );\n\n        return {\n            title: `Notion - ${title}`,\n            link,\n            description,\n            image,\n            item: items,\n            allowEmpty: true,\n        };\n    } catch (error) {\n        logger.error(error);\n\n        if (isNotionClientError(error)) {\n            const { statusCode } = error as any;\n            if (statusCode === APIErrorCode.ObjectNotFound) {\n                throw new InvalidParameterError('The database is not exist');\n            }\n            if (statusCode === APIErrorCode.Unauthorized) {\n                throw new ConfigNotFoundError('Please check the config of NOTION_TOKEN');\n            }\n            ctx.throw(statusCode, 'Notion API Error');\n        } else {\n            ctx.throw(error);\n        }\n        return null;\n    }\n}\n\nfunction parseCustomQuery(queryString) {\n    try {\n        if (queryString) {\n            return JSON.parse(decodeURIComponent(queryString));\n        }\n    } catch {","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/notion/database.ts#L151-L187","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Open the database in Notion, click ••• → Connections, and add your integration — this is the most common fix.","Verify the databaseId in the route URL matches the 32-char hex ID from the Notion URL (the segment before ?v=).","Confirm the integration was created in the same workspace as the database.","If the database was deleted, the feed cannot work — point the route at an existing database."],"exampleFix":"// before\nif (statusCode === APIErrorCode.ObjectNotFound) {\n    throw new InvalidParameterError('The database is not exist');\n}\n\n// after — clearer message + caller fix\nif (statusCode === APIErrorCode.ObjectNotFound) {\n    throw new InvalidParameterError(`Database not found or not shared with the integration: ${databaseId}`);\n}\n// caller: share the DB with the integration in Notion → Connections","handlingStrategy":"validation","validationCode":"// Validate the ID shape before calling, and confirm sharing out-of-band.\nconst NOTION_ID = /^[a-f0-9]{32}$/i;\nfunction validDatabaseId(id) {\n  if (!NOTION_ID.test(id)) throw new Error('databaseId must be a 32-char hex string');\n  return id;\n}","typeGuard":"const isNotionNotFound = (e: any): boolean =>\n  e?.code === 'object_not_found' || e?.status === 404 || e?.statusCode === APIErrorCode.ObjectNotFound;","tryCatchPattern":"try { await notion.databases.retrieve({ database_id: id }); }\ncatch (e) {\n  if (isNotionNotFound(e)) {\n    // most likely: DB not shared with the integration — guide user to Connections\n  } else throw e;\n}","preventionTips":["Always share the database with the integration after creating the token.","Extract the ID from the Notion URL carefully (the segment before ?v=).","If multiple workspaces are involved, ensure the integration lives in the right one."],"tags":["notion","api","validation","permissions","authentication"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}