[SalesForce] VS Code and custom Labels

I use VS Code with Salesforce extensions and connect to my sandbox as explained here:

https://forcedotcom.github.io/salesforcedx-vscode/articles/user-guide/org-development-model

With my package.xml I fetched apex classes and custom labels from sandbox.

In settings I enabled push-or-deploy-on-save.

On saving and deploying I always get error messages where custom labels are used:
"External string does not exist: MY_LABEL":

static final String MY_LABEL = Label.MY_LABEL;

My custom labels exist in the sandbox and in my project, so what causes this error?

Regards

Best Answer

Shouldn't you use System to call Custom Labels?

static final String MY_LABEL = System.Label.MY_LABEL;
Related Topic