{"record":{"id":"1a37369a8a659f4b","repo":"DIYgod/RSSHub","slug":"instagram-rss-is-disabled-due-to-the-lack-of-a-hr","errorCode":null,"errorMessage":"Instagram RSS is disabled due to the lack of <a href=\"https://docs.rsshub.app/deploy/config#route-specific-configurations\">relevant config</a>","messagePattern":"Instagram RSS is disabled due to the lack of <a href=\"https://docs\\.rsshub\\.app/deploy/config#route-specific-configurations\">relevant config</a>","errorType":"exception","errorClass":"ConfigNotFoundError","httpStatus":null,"severity":"error","filePath":"lib/routes/instagram/private-api/utils.ts","lineNumber":11,"sourceCode":"import { IgApiClient } from 'instagram-private-api';\n\nimport { config } from '@/config';\nimport ConfigNotFoundError from '@/errors/types/config-not-found';\nimport logger from '@/utils/logger';\n\nconst ig = new IgApiClient();\n\nasync function login(ig, cache) {\n    if (!config.instagram || !config.instagram.username || !config.instagram.password) {\n        throw new ConfigNotFoundError('Instagram RSS is disabled due to the lack of <a href=\"https://docs.rsshub.app/deploy/config#route-specific-configurations\">relevant config</a>');\n    }\n    const LOGIN_CACHE_KEY = 'instagram:login';\n    const { username, password } = config.instagram;\n    const state = await cache.get(LOGIN_CACHE_KEY);\n    if (state) {\n        ig.state.deserialize(state);\n    } else {\n        ig.state.generateDevice(username);\n        // try {\n        //     await ig.simulate.preLoginFlow();\n        // } catch (error) {\n        //     logger.info('Instagram preLoginFlow fail: ' + error);\n        // }\n        await ig.account.login(username, password);\n        queueMicrotask(() => ig.simulate.postLoginFlow());\n        logger.debug('Instagram login success.');\n    }\n    // Post request hook","sourceCodeStart":1,"sourceCodeEnd":29,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/instagram/private-api/utils.ts#L1-L29","documentation":"Thrown as `ConfigNotFoundError` by the Instagram private-API login helper when `config.instagram` is missing or lacks `username`/`password`. The private API requires authenticated (username+password) login against Instagram's private endpoints — there is no anonymous mode. Without these the route cannot create an `IgApiClient` session, so it aborts immediately.","triggerScenarios":"Self-hosted RSSHub instance where the operator has not set the `IG_USERNAME`/`IG_PASSWORD` (or `INSTAGRAM_USERNAME`/`INSTAGRAM_PASSWORD`) environment variables; a request hits the private-API Instagram route before any config is supplied.","commonSituations":"Fresh deploy without env vars; `.env` missing the Instagram block; the variables were renamed or unset during a redeploy; running on the public rsshub.app instance which intentionally does not provide credentials (so these routes are effectively self-host-only).","solutions":["Set `INSTAGRAM_USERNAME` and `INSTAGRAM_PASSWORD` in the RSSHub environment (or the `instagram` block of config) and restart.","If you cannot supply credentials, switch to the web-API variant (`/instagram/user/...` via web-api/index.ts) which can work with a cookie instead, or run anonymously where supported.","Verify the env vars are actually loaded by the process (check `config.instagram` is truthy)."],"exampleFix":"// before: no env\n// after: in .env\nINSTAGRAM_USERNAME=your_account\nINSTAGRAM_PASSWORD=your_app_password","handlingStrategy":"validation","validationCode":"function hasIgCreds(): boolean {\n  return Boolean(config.instagram?.username && config.instagram?.password);\n}\n// gate the route registration or short-circuit with a friendly message if !hasIgCreds()","typeGuard":"const igConfigOk = (c?: {username?:string;password?:string}): c is {username:string;password:string} =>\n    Boolean(c && c.username && c.password);","tryCatchPattern":null,"preventionTips":["Set Instagram credentials via env vars at deploy time and assert them on boot.","Use ConfigNotFoundError so RSSHub reports it as a config issue, not a crash.","Keep credentials in a secret manager, not in code."],"tags":["instagram","config-not-found","self-host","authentication"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}