MaaAssistantArknights/MaaAssistantArknights · critical

MAA return false

Error message

MAA return false

What it means

ErrorMAAFalse is returned when the underlying MAA Core C API returns 0 (false) instead of a truthy handle/result. In this library it is raised by asstLoadResource (src/Golang/maa/maa.go:100-118) when AsstLoadResource reports failure loading the resource bundle. It signals the core library rejected the call inputs rather than a Go-side syscall error.

Source

Thrown at src/Golang/maa/maa.go:15

package maa

import (
	"MaaAssistantArknights/conf"
	"errors"
	"fmt"
	"os"
	"sync"
	"syscall"

	log "github.com/sirupsen/logrus"
)

var (
	ErrorMAAFalse          = errors.New("MAA return false")
	ErrorAsstCreateEx      = errors.New("AsstCreateEx failed")
	ErrorAsstLoadSource    = errors.New("AsstLoadSource failed")
	ErrorAsstConnect       = errors.New("AsstConnect failed")
	ErrorAsstCreate        = errors.New("AsstCreate failed")
	ErrorAsstGetVersion    = errors.New("AsstGetVersion failed")
	ErrorAsstAppendTask    = errors.New("AsstAppendTask failed")
	ErrorAsstSetTaskParams = errors.New("AsstSetTaskParams failed")
	ErrorAsstStart         = errors.New("AsstStart failed")
	ErrorAsstStop          = errors.New("AsstStop failed")
	ErrorAsstRunning       = errors.New("AsstRunning failed")
	ErrorAsstDestroy       = errors.New("AsstDestroy failed")
)

type AsstCallback func(message int, details uintptr, arg uintptr) uintptr

type Maa struct {
	asstHandle uintptr
	version    string

View on GitHub (pinned to 68e5200d0a)

Solutions

  1. Verify cfg.ResourcePath points to the MAA install directory that contains the 'resource' folder, and that base resource + any game-version resource dirs exist
  2. If ResourcePath is empty, ensure the process working directory is the MAA root (os.Getwd() is used as fallback)
  3. Check that the MAA Core shared library version matches the resource version (update both together)
  4. Check the logrus output line 'asstLoadResource' with fields path/r1/err for the concrete reason

Example fix

// before
maa, err := maa.New(&conf.Asst{}) // ResourcePath empty, cwd is not MAA root
// after
maa, err := maa.New(&conf.Asst{ResourcePath: "/opt/MAA"}) // dir containing resource/
Defensive patterns

Strategy: validation

Validate before calling

func validateResourcePath(p string) error {
	if p == "" {
		return errors.New("ResourcePath is empty and cwd may not be the MAA root")
	}
	info, err := os.Stat(filepath.Join(p, "resource"))
	if err != nil || !info.IsDir() {
		return fmt.Errorf("no resource/ dir under %s", p)
	}
	return nil
}

Type guard

func isMAAFalse(err error) bool { return errors.Is(err, maa.ErrorMAAFalse) }

Try / catch

m, err := maa.New(cfg)
if errors.Is(err, maa.ErrorMAAFalse) {
	log.Fatalf("resource load rejected by MAA core, check ResourcePath=%q", cfg.ResourcePath)
}

Prevention

When it happens

Trigger: Calling maa.New() -> initasst() -> asstLoadResource(path) when the wrapped AsstLoadResource C call returns 0; i.e. the resource path string converts fine but MAA cannot load the resource directory.

Common situations: ResourcePath points to a directory without the MAA resource files (base/resource or resource subfolders missing), running the binary from the wrong working directory so the default os.Getwd() path is wrong, or a MAA Core version mismatch where the resource schema is incompatible with the loaded core DLL/SO.

Related errors


AI-assisted analysis of MaaAssistantArknights/MaaAssistantArknights@68e5200d0a (2026-09-01). Data as JSON: /api/errors/5baaa5b6e60b8de6. Report an issue: GitHub.