Skip to content

fix: "attempt to index local 'config' (a nil value)" when running :HttpEnvFile #9

Merged
heilgar merged 2 commits intoheilgar:mainfrom
valchx:valchx/fix-HttpEnvFile
Apr 8, 2025
Merged

fix: "attempt to index local 'config' (a nil value)" when running :HttpEnvFile #9
heilgar merged 2 commits intoheilgar:mainfrom
valchx:valchx/fix-HttpEnvFile

Conversation

@valchx
Copy link
Contributor

@valchx valchx commented Apr 8, 2025

I have an issue where running the :HttpEnvFile returns an error:

Error executing Lua callback: ...nvim-http-client/lua/http_client/commands/select_env.lua:8: attempt to index local 'config'
(a nil value)
stack traceback:
        ...nvim-http-client/lua/http_client/commands/select_env.lua:8: in function 'select_env_file'
        ...hare/nvim/lazy/nvim-http-client/lua/http_client/init.lua:71: in function <...hare/nvim/lazy/nvim-http-client/lua/h
ttp_client/init.lua:70>

After a quick check, I find that we call config.get() without passing any key.

select_env_file expects to receive the whole config. So instead of calling get, I pass options.

@valchx valchx changed the title fix :HttpEnvFile fix: "attempt to index local 'config' (a nil value)" when running :HttpEnvFile Apr 8, 2025
@heilgar
Copy link
Owner

heilgar commented Apr 8, 2025

@valchx thanks for fix

@heilgar heilgar merged commit 9df88ea into heilgar:main Apr 8, 2025
2 checks passed
@valchx valchx deleted the valchx/fix-HttpEnvFile branch April 11, 2025 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants