{"record":{"id":"a84d48161774040f","repo":"matryer/xbar","slug":"variables-v-name-has-unsupported-type-v-type","errorCode":null,"errorMessage":"Variables: ${v.name} has unsupported type ${v.type} (skipping)","messagePattern":"Variables: (.+?) has unsupported type (.+?) \\(skipping\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"app/frontend/src/InstalledPluginView.svelte","lineNumber":86,"sourceCode":"\t\tif (!variables || !values) return; // wait for both\n\t\tvariables.forEach((v) => {\n\t\t\tif (typeof values[v.name] !== 'undefined') {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tswitch (v.type) {\n\t\t\t\tcase 'string':\n\t\t\t\tcase 'select':\n\t\t\t\t\tvalues[v.name] = v.default;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'boolean':\n\t\t\t\t\tconst def = v.default || '';\n\t\t\t\t\tvalues[v.name] = def.toUpperCase() == 'TRUE';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'number':\n\t\t\t\t\tvalues[v.name] = parseFloat(v.default) || 0;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`Variables: ${v.name} has unsupported type ${v.type} (skipping)`\n\t\t\t\t\t);\n\t\t\t}\n\t\t});\n\t}\n\n\tfunction onValuesChanged() {\n\t\tsaveVariableValues(installedPlugin.path, variableValues);\n\t}\n\n\tlet pluginEnableToggleWaiter = 0;\n\tfunction toggleEnabled() {\n\t\tpluginEnableToggleWaiter++;\n\t\tinstalledPlugin.enabled = !installedPlugin.enabled;\n\t\tsetEnabled(installedPlugin.path, installedPlugin.enabled)\n\t\t\t.then((updatedPath) => {\n\t\t\t\t// redirect to new place\n\t\t\t\tselectedInstalledPluginPath.set(updatedPath);","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/matryer/xbar/blob/d624239058997c80118eaebe2e7f8331b3c765e0/app/frontend/src/InstalledPluginView.svelte#L68-L104","documentation":"This is a client-side console.warn emitted by updateValues() in InstalledPluginView.svelte while seeding default values for an installed plugin's variables. The code switches on v.type and only knows 'string', 'select', 'boolean', and 'number'; any other type string hits the default branch and the variable is skipped (no default value is written into the values object). It is not an exception — the UI continues rendering, but the variable will have no initialized value.","triggerScenarios":"A plugin's metadata (installedPlugin.vars) contains a variable whose v.type is not one of 'string', 'select', 'boolean', or 'number' — e.g. a typo like 'bool', 'string ' with trailing whitespace, 'int', 'list', uppercase 'String', or a newer variable type added by the plugin API that this view does not handle yet.","commonSituations":"Plugin authors misspelling or capitalizing the type in their plugin manifest/metadata; a plugin schema evolved to add new types (e.g. arrays or secret) while the frontend switch was not updated; stale plugin metadata cached from an older format; copy-pasted type names from another plugin system.","solutions":["Fix the variable's type in the plugin's metadata so it is exactly one of 'string', 'select', 'boolean', or 'number' (check for typos, casing, and trailing whitespace).","Add a case for the new type in updateValues() in app/frontend/src/InstalledPluginView.svelte:73 so the variable gets a sensible default instead of being skipped.","Normalize the type before the switch (e.g. v.type.trim().toLowerCase()) to tolerate formatting differences in plugin metadata.","Give the variable a fallback default (e.g. treat unknown types as strings) if skipping leaves the UI in a broken state."],"exampleFix":"// before\ndefault:\n    console.warn(\n        `Variables: ${v.name} has unsupported type ${v.type} (skipping)`\n    );\n// after\ndefault: {\n    console.warn(\n        `Variables: ${v.name} has unsupported type ${v.type} (skipping)`\n    );\n    values[v.name] = v.default ?? ''; // treat unknown types as strings\n}","handlingStrategy":"validation","validationCode":"const SUPPORTED_TYPES = ['string', 'select', 'boolean', 'number'];\nconst unsupported = (plugin.vars || []).filter(v => !SUPPORTED_TYPES.includes(String(v.type).trim().toLowerCase()));\nif (unsupported.length) {\n    console.warn('Unsupported variable types:', unsupported.map(v => `${v.name}:${v.type}`));\n}","typeGuard":"function isSupportedVarType(type) {\n    return ['string', 'select', 'boolean', 'number'].includes(String(type).trim().toLowerCase());\n}","tryCatchPattern":null,"preventionTips":["Validate plugin variable types against a known whitelist when loading plugin metadata.","Normalize type strings (trim/lowercase) before switching on them.","When adding a new variable type to the plugin API, update every consumer's switch statement and add a default fallback.","Unit-test updateValues with all supported types plus an unknown type to ensure the warn path is intentional."],"tags":["javascript","svelte","plugin-metadata","unsupported-type","console-warn"],"backgroundTag":"unsupported-variable-type","analyzedSha":"d624239058997c80118eaebe2e7f8331b3c765e0","analyzedAt":"2026-09-02T22:38:22.007Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}