Skip to content

InstanceLibrary rejects a missing instance folder before it can download it #185

Description

@ehennestad

Problem

InstanceLibrary.getSingleton declares its folderPath argument with {mustBeFolder}, defaulting to Paths.LocalInstanceFolder, and the class constructor declares the same. On a fresh installation that folder does not exist yet, so the validator rejects the call before the constructor runs:

MATLAB:validators:mustBeFolder
Invalid argument at position 1. These folders do not exist: '.../openMINDS_instances-main/instances'.

The constructor is written for exactly this case: postSetInstanceLibraryLocation downloads the repository when ~isfolder(obj.InstanceLibraryLocation). That branch is unreachable, because the validator runs first. The download only happens today because setup.m calls downloadControlledInstances separately, and an installed toolbox never runs setup.m. A user of the .mltbx whose first call touches controlled instances gets a validation error instead of a download.

Fix

Drop mustBeFolder from both signatures, or validate after the download has had its chance. Since #184 the location is resolved to an absolute path when it is set, so a folder that does not exist yet is a well defined place to download into.

🤖 Generated with Claude Code

Activity

  1. added 2 commits that reference this issue on Sep 11, 2026
    cac6fd7
    c887998
  2. ehennestad commented on Sep 11, 2026

    @ehennestad
    CollaboratorAuthor

    Two related gaps, found reviewing the stack that fixes the validator (#188), and left for whoever picks this up:

    • postSetInstanceLibraryLocation decides whether to download from ~isfolder(obj.InstanceLibraryLocation) || ~isRecordedCommitCurrent(...), but downloadRepository always writes to the default target. For a caller-named location that exists and whose recorded commit reads as stale, that downloads into the default location while InstanceLibraryLocation keeps pointing at the custom folder. fix: report what a controlled instance lookup cannot resolve #188 rejects a custom location that holds no version folder before construction, which narrows this, but a custom location that holds versions still reaches it.
    • UseGit=true selects a branch whose only statement is a commented-out pullRepository call, so it disables the download and does nothing else. The help text on getSingleton says so; the option should either do what its name says or go.

    🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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