Skip to content

[Help] How to debug Caught error: interface conversion: interface {} is bool, not string #296

@Hugo1380

Description

@Hugo1380

Hello,

I am having trouble debugging the following error when I try to configure my API (FastAPI) in Restish. I obtain the following error:

> restish api configure -H x-api-key:mkey -vvv myapi # My API requires an x-api-key header for all routes.
...
displaying my openapi.json
...
ERROR: Caught error: interface conversion: interface {} is bool, not string
DEBUG: goroutine 1 [running]:
runtime/debug.Stack()
	/usr/local/go/src/runtime/debug/stack.go:26 +0x64
github.com/danielgtaylor/restish/cli.Run.func1()
	/Users/myuser/go/pkg/mod/github.com/danielgtaylor/[email protected]/cli/cli.go:849 +0x60
panic({0x101ab4800?, 0x14000922330?})
	/usr/local/go/src/runtime/panic.go:785 +0x124
github.com/danielgtaylor/restish/cli.Param.AddFlag({{0x10179e44f, 0x6}, {0x140006454a0, 0x7}, {0x0, 0x0}, {0x14000634660, 0x2b}, 0x0, 0x0, ...}, ...)
	/Users/myuser/go/pkg/mod/github.com/danielgtaylor/[email protected]/cli/param.go:132 +0x6d0
github.com/danielgtaylor/restish/cli.Operation.command({{0x140007bc6e0, 0x42}, {0x14000766bb0, 0xf}, {0x1400004bca0, 0x1, 0x1}, {0x140006360c0, 0x16}, {0x140001b2580, ...}, ...})
	/Users/myuser/go/pkg/mod/github.com/danielgtaylor/[email protected]/cli/operation.go:147 +0x508
github.com/danielgtaylor/restish/cli.setupRootFromAPI(0x14000107b08, 0x4?)
	/Users/myuser/go/pkg/mod/github.com/danielgtaylor/[email protected]/cli/api.go:76 +0xb8
github.com/danielgtaylor/restish/cli.load(_, {{0x140000b6fa8, 0x4}, {0x0, 0x0}, 0x0, {0x140000b6faf, 0xe}, {0x140000b6fbd, 0x1}, ...}, ...)
	/Users/myuser/go/pkg/mod/github.com/danielgtaylor/[email protected]/cli/api.go:86 +0x128
github.com/danielgtaylor/restish/cli.Load({0x140000b6f90, 0x15}, 0x14000107b08)
	/Users/myuser/go/pkg/mod/github.com/danielgtaylor/[email protected]/cli/api.go:275 +0x10e8
github.com/danielgtaylor/restish/cli.askLoadBaseAPI({0x101ba0c00, 0x102525920}, 0x140000ad440)
	/Users/myuser/go/pkg/mod/github.com/danielgtaylor/[email protected]/cli/interactive.go:88 +0x74
github.com/danielgtaylor/restish/cli.askBaseURI({0x101ba0c00, 0x102525920}, 0x140000ad440)
	/Users/myuser/go/pkg/mod/github.com/danielgtaylor/[email protected]/cli/interactive.go:81 +0x88
github.com/danielgtaylor/restish/cli.askInitAPI({0x101ba0c00, 0x102525920}, 0x140004ad9c8?, {0x140004257c0, 0x1, 0x0?})
	/Users/myuser/go/pkg/mod/github.com/danielgtaylor/[email protected]/cli/interactive.go:391 +0x28c
github.com/danielgtaylor/restish/cli.askInitAPIDefault(0x1400013e000?, {0x140004257c0?, 0x4?, 0x1017981fb?})
	/Users/myuser/go/pkg/mod/github.com/danielgtaylor/[email protected]/cli/interactive.go:441 +0x40
github.com/spf13/cobra.(*Command).execute(0x140000cf808, {0x14000425780, 0x4, 0x4})
	/Users/myuser/go/pkg/mod/github.com/spf13/[email protected]/command.go:920 +0x630
github.com/spf13/cobra.(*Command).ExecuteC(0x140002f0c08)
	/Users/myuser/go/pkg/mod/github.com/spf13/[email protected]/command.go:1044 +0x320
github.com/spf13/cobra.(*Command).Execute(...)
	/Users/myuser/go/pkg/mod/github.com/spf13/[email protected]/command.go:968
github.com/danielgtaylor/restish/cli.Run()
	/Users/myuser/go/pkg/mod/github.com/danielgtaylor/[email protected]/cli/cli.go:857 +0xbc0
main.main()
	/Users/myuser/go/pkg/mod/github.com/danielgtaylor/[email protected]/main.go:40 +0x318

I can see the GET request for /openapi.json.

INFO   127.0.0.1:56687 - "GET /openapi.json HTTP/1.1" 200

Has anyone encountered this error before? Or could you please help me debug it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions