Skip to content

RenpyTaskProvider Crashes with Undefined Command #536

Description

@pythonibc

Bug Report: RenpyTaskProvider Crashes with Undefined Command

Extension: renpy.language-renpy v805.1.0
VS Code Version: 1.96.x (tested on Windows 11)
Date: January 15, 2026
Severity: Medium (causes console errors but doesn't break functionality)


Summary

The RenpyTaskProvider.getTask() method crashes when attempting to create a task with an undefined or null command parameter. This occurs when VS Code's task system refreshes in response to configuration changes.


Error Message

Error: Illegal argument: command can't be undefined or null
    at $e (file:///c:/Users/terru/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:7:1458)
    at new Aa (file:///c:/Users/terru/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:112:36896)
    at n.RenpyTaskProvider.getTask (c:\Users\terru\.vscode\extensions\renpy.language-renpy-805.1.0\dist\extension.js:2:729223)
    at n.RenpyTaskProvider.getTasks (c:\Users\terru\.vscode\extensions\renpy.language-renpy-805.1.0\dist\extension.js:2:728797)
    at n.RenpyTaskProvider.provideTasks (c:\Users\terru\.vscode\extensions\renpy.language-renpy-805.1.0\dist\extension.js:2:728629)

Reproduction Steps

  1. Install Ren'Py extension v805.1.0
  2. Open any workspace (doesn't need to be a Ren'Py project)
  3. Trigger a configuration change event (e.g., via another extension or manual settings update)
  4. VS Code broadcasts configuration change to all extensions
  5. Ren'Py extension's RenpyTaskProvider.provideTasks() is called
  6. Error occurs in getTask() when command parameter is undefined

Minimal reproduction:

  • Have Ren'Py extension installed
  • Execute: vscode.workspace.getConfiguration('any').update('anySetting', 'anyValue')
  • Observe console error

Root Cause

The getTask() method in RenpyTaskProvider does not validate that the command parameter is defined before passing it to VS Code's Task constructor.

Expected behavior:

  • Method should validate command parameter
  • Return null or skip task creation if command is undefined
  • Or provide a default/fallback command value

Actual behavior:

  • Method passes undefined directly to new Task(command, ...)
  • VS Code API throws error: "command can't be undefined or null"

Suggested Fix

// In RenpyTaskProvider class

getTask(command?: string): vscode.Task | undefined {
    // Add validation
    if (!command) {
        console.warn('[RenpyTaskProvider] getTask called with undefined command');
        return undefined;
    }
    
    // Existing task creation logic
    return new vscode.Task(
        { type: 'renpy', task: command },
        vscode.TaskScope.Workspace,
        command,
        'Ren\'Py',
        // ... rest of task configuration
    );
}

provideTasks(): vscode.Task[] {
    const tasks: vscode.Task[] = [];
    
    // Ensure commands array exists and is valid
    const commands = this.getAvailableCommands();
    
    for (const cmd of commands) {
        const task = this.getTask(cmd);
        if (task) {  // Only add valid tasks
            tasks.push(task);
        }
    }
    
    return tasks;
}

Impact

User Impact: Low - Error appears in console but doesn't affect Ren'Py functionality
Developer Impact: Medium - Clutters console with stack traces during development
Frequency: Occurs on every configuration change event


Environment

  • OS: Windows 11
  • VS Code: 1.96.x
  • Extension Version: renpy.language-renpy v805.1.0
  • Installed Extensions: Multiple (BranchPy, Python, etc.)
  • Workspace: Multi-folder workspace

Additional Context

This issue became noticeable when another extension (BranchPy) implemented configuration management features that trigger frequent config updates. The error does not affect either extension's functionality but creates unnecessary noise in the developer console.

The VS Code Task API documentation explicitly states that task definitions must have valid command values: https://code.visualstudio.com/api/extension-guides/task-provider


Workaround

Users can temporarily disable the Ren'Py extension if the console errors are problematic, though this is not ideal for Ren'Py developers.


Reporter: BranchPy Development Team
Contact: Available for follow-up questions or testing patches

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