Skip to content

Conversation

@Talbot3
Copy link

@Talbot3 Talbot3 commented Jan 17, 2026

Bug Report

Summary

The Java plugin fails on macOS ARM64 because the foojay API expects aarch64 but the plugin sends arm64.

Steps to Reproduce

  1. Run on macOS ARM64 (Apple Silicon)
  2. Execute: vfox install [email protected]
  3. Error: attempt to index a non-table object(nil) with key 'links'

Root Cause

  1. Architecture mismatch: RUNTIME.archType returns arm64 but foojay API expects aarch64
  2. Poor error handling: When API returns empty results, the code crashes with unclear error

API Verification

# Returns empty (wrong)
curl "https://api.foojay.io/disco/v3.0/packages/jdks?version=17.0.7&distribution=zulu&architecture=arm64..."

# Returns 2 results (correct)
curl "https://api.foojay.io/disco/v3.0/packages/jdks?version=17.0.7&distribution=zulu&architecture=aarch64..."

Proposed Fix

lib/foojay.lua - Add architecture conversion:
-- Convert arm64 to aarch64 for foojay API compatibility
local arch = RUNTIME.archType
if arch == "arm64" then
    arch = "aarch64"
end
local reqUrl = URL:format(version, distribution, arch, archive_type, os, lib_c_type)

hooks/pre_install.lua - Better error handling:
if not jdks or #jdks == 0 then
    error("No JDK found for " .. ctx.version .. " on " .. RUNTIME.osType .. "/" .. RUNTIME.archType)
end

Additional Fix

Also removed latest=available parameter from API URL to ensure exact version matching.

Reference

- foojay API: https://github.com/foojayio/discoapi

Talbot3 and others added 2 commits January 17, 2026 19:44
- Convert arm64 to aarch64 for foojay API compatibility
- Remove latest=available parameter to ensure exact version matching
- Improve error handling when no JDK is found for requested version

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Change from 'vfox install java x.y.z-dist' to 'vfox install [email protected]'

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant