plandex-ai / plandex

AI driven development in your terminal. Designed for large, real-world tasks.
https://plandex.ai
GNU Affero General Public License v3.0
10.51k stars 730 forks source link

panic: runtime error: invalid memory address or nil pointer dereference #76

Closed joshstrange closed 3 months ago

joshstrange commented 4 months ago

This is almost 100% my fault. I signed in with my email (josh@ my username .com) then ctrl-c'd out because I wanted to use a different email address, for my business, before changing my mind again and using my personal account. I wiped the .plandex-home directory since I was already logged in and re-installed (which recreated the directory) but I keep getting this error.

josh@MacBook-Pro frontend % plandex new
? 👋 Hey there!
It looks like this is your first time using Plandex on this computer.
What would you like to do? Sign in, accept an invite, or create an account
? Use Plandex Cloud or another host? Plandex Cloud
✔ Your email: … <REMOVED>
✉️  You'll now receive a 6 character pin by email. It will be valid for 5 minutes.
✔ Please enter your pin: … ******
🧐 You don't have access to any orgs yet.

To join an existing org, ask an admin to either invite you directly or give your whole email domain access.

Otherwise, you can go ahead and create a new org.
Create a new org now? (y)es | (n)o> y
✔ Org name: … <removed>
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x18 pc=0x1009544d4]

goroutine 1 [running]:
plandex/auth.createOrg()
    /Users/ds/projects/plandex/app/cli/auth/org.go:67 +0x84
plandex/auth.promptNoOrgs()
    /Users/ds/projects/plandex/app/cli/auth/org.go:55 +0xc4
plandex/auth.resolveOrgAuth({0x0?, 0x14000028288?, 0x14?})
    /Users/ds/projects/plandex/app/cli/auth/org.go:16 +0x98
plandex/auth.signIn({0x14000028288, 0x14}, {0x1400000f110, 0x6}, {0x0, 0x0})
    /Users/ds/projects/plandex/app/cli/auth/account.go:217 +0x9c
plandex/auth.promptSignInNewAccount()
    /Users/ds/projects/plandex/app/cli/auth/account.go:178 +0x278
plandex/auth.SelectOrSignInOrCreate()
    /Users/ds/projects/plandex/app/cli/auth/account.go:53 +0x38
plandex/auth.promptInitialAuth()
    /Users/ds/projects/plandex/app/cli/auth/account.go:33 +0x124
plandex/auth.MustResolveAuth(0x1)
    /Users/ds/projects/plandex/app/cli/auth/auth.go:26 +0x330
plandex/auth.MustResolveAuthWithOrg(...)
    /Users/ds/projects/plandex/app/cli/auth/auth.go:13
plandex/cmd.new(0x1400050a900?, {0x10138c440?, 0x4?, 0x1009df147?})
    /Users/ds/projects/plandex/app/cli/cmd/new.go:35 +0x2c
github.com/spf13/cobra.(*Command).execute(0x101331dc0, {0x10138c440, 0x0, 0x0})
    /Users/ds/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:987 +0x814
github.com/spf13/cobra.(*Command).ExecuteC(0x101332f00)
    /Users/ds/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x344
github.com/spf13/cobra.(*Command).Execute(...)
    /Users/ds/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039
plandex/cmd.Execute()
    /Users/ds/projects/plandex/app/cli/cmd/root.go:23 +0x24
main.main()
    /Users/ds/projects/plandex/app/cli/main.go:55 +0x90

Related, trying to switch to the plan an anonymous account is now giving me this:

josh@MacBook-Pro frontend % plandex new
? 👋 Hey there!
It looks like this is your first time using Plandex on this computer.
What would you like to do? Start an anonymous trial on Plandex Cloud (no email required)
🚨 Error creating plan
  → Project does not exist in org
josh@MacBook-Pro frontend % plandex new
🚨 Error creating plan
  → Project does not exist in org

I assume there is some other config I need to delete to do a full "reset". It was working at one point (anon account) but I deleted the home folder so I could login (I hit enter by accident when setting it up again, yeah, I'm batting 1000 today...) and now I can't get back to that working-anon state either.

Sorry, this is 100% user-error.

danenania commented 4 months ago

Sorry about that! It should definitely recover smoothly after a ctrl+c rather than failing like that.

You can reset fully with rm -rf $HOME/.plandex-home and rm -rf .plandex from the current directory, then run plandex new again.

danenania commented 4 months ago

If you're still having any issues, let me know and I can remove your account from the cloud as well in order to give you a totally fresh start.

joshstrange commented 4 months ago

I tried removing both the home directory and product directory files but I still get this error when entering my org name. I think my org name is burned somehow (joshstrange). I used a different name and now it's working. Thank you!

josh@MacBook-Pro frontend % plandex new
? 👋 Hey there!
It looks like this is your first time using Plandex on this computer.
What would you like to do? Sign in, accept an invite, or create an account
? Use Plandex Cloud or another host? Plandex Cloud
✔ Your email: … <REMOVED>
✉️  You'll now receive a 6 character pin by email. It will be valid for 5 minutes.
✔ Please enter your pin: … ******
🧐 You don't have access to any orgs yet.

To join an existing org, ask an admin to either invite you directly or give your whole email domain access.

Otherwise, you can go ahead and create a new org.
Create a new org now? (y)es | (n)o> y
✔ Org name: … <REMOVED>
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x18 pc=0x1009b04d4]

goroutine 1 [running]:
plandex/auth.createOrg()
    /Users/ds/projects/plandex/app/cli/auth/org.go:67 +0x84
plandex/auth.promptNoOrgs()
    /Users/ds/projects/plandex/app/cli/auth/org.go:55 +0xc4
plandex/auth.resolveOrgAuth({0x0?, 0x140000a2378?, 0x14?})
    /Users/ds/projects/plandex/app/cli/auth/org.go:16 +0x98
plandex/auth.signIn({0x140000a2378, 0x14}, {0x14000399770, 0x6}, {0x0, 0x0})
    /Users/ds/projects/plandex/app/cli/auth/account.go:217 +0x9c
plandex/auth.promptSignInNewAccount()
    /Users/ds/projects/plandex/app/cli/auth/account.go:178 +0x278
plandex/auth.SelectOrSignInOrCreate()
    /Users/ds/projects/plandex/app/cli/auth/account.go:53 +0x38
plandex/auth.promptInitialAuth()
    /Users/ds/projects/plandex/app/cli/auth/account.go:33 +0x124
plandex/auth.MustResolveAuth(0x1)
    /Users/ds/projects/plandex/app/cli/auth/auth.go:26 +0x330
plandex/auth.MustResolveAuthWithOrg(...)
    /Users/ds/projects/plandex/app/cli/auth/auth.go:13
plandex/cmd.new(0x14000112800?, {0x1013e8440?, 0x4?, 0x100a3b147?})
    /Users/ds/projects/plandex/app/cli/cmd/new.go:35 +0x2c
github.com/spf13/cobra.(*Command).execute(0x10138ddc0, {0x1013e8440, 0x0, 0x0})
    /Users/ds/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:987 +0x814
github.com/spf13/cobra.(*Command).ExecuteC(0x10138ef00)
    /Users/ds/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x344
github.com/spf13/cobra.(*Command).Execute(...)
    /Users/ds/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039
plandex/cmd.Execute()
    /Users/ds/projects/plandex/app/cli/cmd/root.go:23 +0x24
main.main()
    /Users/ds/projects/plandex/app/cli/main.go:55 +0x90
danenania commented 4 months ago

Ok strange about the org name, will investigate that. Glad to hear it's working for you now.