Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid default environment results in Rebuild IntelliSense index failure with obscure error message #2265

pfeerick opened this issue Mar 29, 2019 · 1 comment


None yet
2 participants
Copy link

commented Mar 29, 2019

What kind of issue is this?

  • PlatformIO Core.
    If you’ve found a bug, please provide information below.


Operating system: Windows 10

PlatformIO Version (platformio --version): 3.6.6

Description of problem

If the environment set in env_default doesn't exist (i.e. was renamed), and you try to rebuild the intellisense index, it will fail with a NameError: name 'cc_flags' is not defined, rather than informing that the actual issue is an invalid default build environment.

Steps to Reproduce

  1. Have one more environments in your platformio.ini and a env_default.
  2. Change the name of the one set as default, or change the default to an invalid name
  3. Try to Rebuild IntelliSense Index and wait for the red...

Actual Results

IntelliSense rebuild appears to fail due to a misleading errror about a missing cc_flag definition.

Expected Results

Either accepts invalid configuration or preferably detects and informs of it.

If problems with PlatformIO Build System:

The content of platformio.ini:

env_default = uno3

platform = atmelavr
board = uno
framework = arduino

platform = atmelavr
board = uno
framework = arduino

Source file to reproduce issue:

#include <Arduino.h>

void setup() {
  // put your setup code here, to run once:

void loop() {
  // put your main code here, to run repeatedly:

Additional info

> Executing task in folder new project: C:\Users\Peter\.platformio\penv\Scripts\platformio.exe init --ide vscode <

The current working directory c:\Users\Peter\Documents\PlatformIO\Projects\new project will be used for the project.

The next files/directories have been created in c:\Users\Peter\Documents\PlatformIO\Projects\new project
include - Put project header files here
lib - Put here project specific (private) libraries
src - Put project source files here
platformio.ini - Project Configuration File
Error: Traceback (most recent call last):
  File "c:\users\peter\.platformio\penv\lib\site-packages\platformio\", line 120, in main
    cli(None, None, None)
  File "c:\users\peter\.platformio\penv\lib\site-packages\click\", line 700, in __call__
    return self.main(*args, **kwargs)
  File "c:\users\peter\.platformio\penv\lib\site-packages\click\", line 680, in main
    rv = self.invoke(ctx)
  File "c:\users\peter\.platformio\penv\lib\site-packages\click\", line 1027, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\users\peter\.platformio\penv\lib\site-packages\click\", line 873, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\users\peter\.platformio\penv\lib\site-packages\click\", line 508, in invoke
    return callback(*args, **kwargs)
  File "c:\users\peter\.platformio\penv\lib\site-packages\click\", line 16, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "c:\users\peter\.platformio\penv\lib\site-packages\platformio\commands\", line 102, in cli
  File "c:\users\peter\.platformio\penv\lib\site-packages\platformio\ide\", line 121, in generate
  File "c:\users\peter\.platformio\penv\lib\site-packages\platformio\ide\", line 127, in _render_tpl
    return bottle.template(content, **self._tplvars)
  File "c:\users\peter\.platformio\penv\scripts\", line 3622, in template
    return TEMPLATES[tplid].render(kwargs)
  File "c:\users\peter\.platformio\penv\scripts\", line 3411, in render
    self.execute(stdout, env)
  File "c:\users\peter\.platformio\penv\scripts\", line 3398, in execute
    eval(, env)
  File "<string>", line 56, in <module>
NameError: name 'cc_flags' is not defined


An unexpected error occurred. Further steps:

* Verify that you have the latest version of PlatformIO using
  `pip install -U platformio` command

* Try to find answer in FAQ Troubleshooting section

* Report this problem to the developers


@ivankravets ivankravets added this to the 3.6.7 milestone Mar 29, 2019

@ivankravets ivankravets added the bug label Mar 29, 2019

ivankravets added a commit that referenced this issue Apr 18, 2019


This comment has been minimized.

Copy link

commented Apr 18, 2019

Thanks for the report!

@ivankravets ivankravets referenced this issue Apr 23, 2019


platformio 3.6.7 #39182

5 of 5 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.