Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[Bug]: appsmithctl restore ignores --backup-db-name=<name> and restores from the manifest database name

Open Beginner friendly
#42,295 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
mongodb, typescript
Domain
cli, databases

Research direction

Start with getBackupDatabaseName in app/client/packages/rts/src/ctl/restore.ts:415-440 and the failing test described for restore.test.ts. Compare its argument handling with the existing getArgValue usage for --backup-file=, then run the restore suite and RTS TypeScript, ESLint, and Prettier checks. Done means the equals-form override returns legacy-db while the manifest remains the fallback.

Written by the indexing model from the issue text.

Description

Is there an existing issue for this?
  • I have searched the existing issues
Description

appsmithctl restore --backup-db-name=<name> ignores the override and restores using the database name from the backup's manifest.json.

getBackupDatabaseName in app/client/packages/rts/src/ctl/restore.ts:415-440 (release @ a6ab36cb26) checks command_args.includes("--backup-db-name"). That only matches an argument that is exactly --backup-db-name. So:

  • --backup-db-name=legacy-db never enters the override branch. The name comes from the manifest ("Backup Database Name: <manifest name>"), and restoreDatabase passes that manifest name to mongorestore --nsFrom.
  • --backup-db-name legacy-db (space form) enters the branch, but command_args[i].split("=")[1] is undefined. The db name becomes undefined.

As a result, the one flag that exists for restoring a backup taken from a differently named database (#25663, #31004) cannot actually be used. --nsFrom maps from the wrong namespace, and the restore can silently omit the data.

What I expect is that --backup-db-name=<name> overrides the manifest name.

Steps To Reproduce
  1. Take a backup whose manifest.json has "dbName": "manifest-db", where the data was actually dumped from legacy-db.
  2. Run appsmithctl restore --backup-db-name=legacy-db.
  3. The log prints Backup Database Name: manifest-db, and mongorestore runs with --nsFrom=manifest-db.*.

Failing unit test (red on release, green with the fix):

it("uses --backup-db-name= when remapping a backup to the target database", async () => {
  jest.spyOn(fsPromises, "readFile").mockResolvedValue(JSON.stringify({ dbName: "manifest-db" }));
  await expect(getBackupDatabaseName("/contents", ["--backup-db-name=legacy-db"])).resolves.toBe("legacy-db");
});
// release: received "manifest-db"

Proposed approach (a fix with a regression test is ready): use the existing getArgValue helper in restore.ts (already used for --backup-file=) to read --backup-db-name=<name>, and keep the manifest fallback. With that change the space form falls back to the manifest name, not undefined. The change is confined to restore.ts. getBackupDatabaseName gains an args parameter that defaults to command_args, so it can be tested. It adds 2 tests in restore.test.ts. The restore suite passes (17/17), along with RTS tsc, ESLint and Prettier.

@contributor-support I'd like to take this. Could it be assigned to me? I'll open the PR against release with Fixes #<this> once it's assigned.

Public Sample App

No response

Environment

Release

Severity

Medium (Frustrating UX)

Issue video log

No response

Version

Self Hosted - release @ a6ab36cb26

Prepared with AI assistance (Claude) from the breken-ai account.

Dominant language
TypeScript
Stars
41k
Forks
4.8k
Avg merge
2d 5h
Merged PRs (30d)
66

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from appsmithorg/appsmith

All issues in appsmithorg/appsmith

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.