Skip to content

Architecture: No error handling for Python interpreter resolution failures, app crashes silently #208

@anshul23102

Description

@anshul23102

Problem

resolvePythonCmd() (lines 22-33) may return non-existent python path, causing cryptic spawn() errors.


Recommended Solution

Validate Python exists before spawning:

function resolvePythonCmd() {
  const venv = process.env.VIRTUAL_ENV;
  let cmd;
  
  if (venv) {
    cmd = process.platform === 'win32'
      ? path.join(venv, 'Scripts', 'python.exe')
      : path.join(venv, 'bin', 'python');
    
    if (fs.existsSync(cmd)) return cmd;
  }
  
  cmd = process.platform === 'win32' ? 'python' : 'python3';
  
  // Verify Python is available
  const { execSync } = require('child_process');
  try {
    execSync(`${cmd} --version`);
    return cmd;
  } catch {
    throw new Error(`Python interpreter not found. Tried: ${cmd}`);
  }
}

Program Template

  • GSSoC '26

Suggested Labels

reliability, error-handling, python, gssoc-eligible
EOF
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions