Originally created by: supreme-gg-gg
Describe the bug
Unable to login after logging out or doing cleanup. This also happened on fresh download on certain devices. Do not open another ticket, comment here if you face the issue, this will be fixed ASAP.
To Reproduce
Steps to reproduce the behavior:
Try logging in again
❯ instagram cleanup
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /Users/supremegg/miniconda3/lib/python3.12/site-packages/instagram/cli.py:14 │
│ 9 in cleanup │
│ │
│ 146 @app.command() │
│ 147 def cleanup(d_all: bool = typer.Option(True, "-a", "--all", help="Clea │
│ 148 │ """Cleanup cache and temporary files""" │
│ ❱ 149 │ client.cleanup(d_all) │
│ 150 │
│ 151 # We add the subcommands to the main app │
│ 152 app.add_typer(auth_app, name="auth", help="Authentication commands (lo │
│ │
│ ╭─── locals ───╮ │
│ │ d_all = True │ │
│ ╰──────────────╯ │
│ │
│ /Users/supremegg/miniconda3/lib/python3.12/site-packages/instagram/client.py │
│ :154 in cleanup │
│ │
│ 151 │
│ 152 def cleanup(delete_all: bool) -> None: │
│ 153 │ """Cleanup cache and temporary files""" │
│ ❱ 154 │ session = SessionManager(None) │
│ 155 │ session.delete_session() │
│ 156 │ typer.echo("Session file cleaned up") │
│ 157 │
│ │
│ ╭───── locals ──────╮ │
│ │ delete_all = True │ │
│ ╰───────────────────╯ │
│ │
│ /Users/supremegg/miniconda3/lib/python3.12/site-packages/instagram/client.py │
│ :17 in init │
│ │
│ 14 │ │ if username is None: │
│ 15 │ │ │ self.username = self.get_default_username() │
│ 16 │ │ │ if not self.username: │
│ ❱ 17 │ │ │ │ raise ValueError("No username provided and no default │
│ 18 │ │
│ 19 │ def get_default_username(self) -> str | None: │
│ 20 │ │ # Fall back to default username if current username is not set │
│ │
│ ╭────────────────────────────── locals ──────────────────────────────╮ │
│ │ self = <instagram.client.sessionmanager object="" at="" 0x1044297c0=""> │ │
│ │ username = None │ │
│ ╰────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
ValueError: No username provided and no default username found in config</instagram.client.sessionmanager>
~ base 00:23:27
❯ instagram auth login
Logging in
An error occurred: No username provided and no default username found in config
Additional context
I do not, at this moment, believe that this is caused by instagrapi. It should be an issue with config setup.
Ticket changed by: supreme-gg-gg