{"record":{"id":"5baaa5b6e60b8de6","repo":"MaaAssistantArknights/MaaAssistantArknights","slug":"maa-return-false","errorCode":null,"errorMessage":"MAA return false","messagePattern":"MAA return false","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src/Golang/maa/maa.go","lineNumber":15,"sourceCode":"package maa\n\nimport (\n\t\"MaaAssistantArknights/conf\"\n\t\"errors\"\n\t\"fmt\"\n\t\"os\"\n\t\"sync\"\n\t\"syscall\"\n\n\tlog \"github.com/sirupsen/logrus\"\n)\n\nvar (\n\tErrorMAAFalse          = errors.New(\"MAA return false\")\n\tErrorAsstCreateEx      = errors.New(\"AsstCreateEx failed\")\n\tErrorAsstLoadSource    = errors.New(\"AsstLoadSource failed\")\n\tErrorAsstConnect       = errors.New(\"AsstConnect failed\")\n\tErrorAsstCreate        = errors.New(\"AsstCreate failed\")\n\tErrorAsstGetVersion    = errors.New(\"AsstGetVersion failed\")\n\tErrorAsstAppendTask    = errors.New(\"AsstAppendTask failed\")\n\tErrorAsstSetTaskParams = errors.New(\"AsstSetTaskParams failed\")\n\tErrorAsstStart         = errors.New(\"AsstStart failed\")\n\tErrorAsstStop          = errors.New(\"AsstStop failed\")\n\tErrorAsstRunning       = errors.New(\"AsstRunning failed\")\n\tErrorAsstDestroy       = errors.New(\"AsstDestroy failed\")\n)\n\ntype AsstCallback func(message int, details uintptr, arg uintptr) uintptr\n\ntype Maa struct {\n\tasstHandle uintptr\n\tversion    string","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/MaaAssistantArknights/MaaAssistantArknights/blob/68e5200d0a787d88807b1516dd118af6d6fa0487/src/Golang/maa/maa.go#L1-L33","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify cfg.ResourcePath points to the MAA install directory that contains the 'resource' folder, and that base resource + any game-version resource dirs exist","If ResourcePath is empty, ensure the process working directory is the MAA root (os.Getwd() is used as fallback)","Check that the MAA Core shared library version matches the resource version (update both together)","Check the logrus output line 'asstLoadResource' with fields path/r1/err for the concrete reason"],"exampleFix":"// before\nmaa, err := maa.New(&conf.Asst{}) // ResourcePath empty, cwd is not MAA root\n// after\nmaa, err := maa.New(&conf.Asst{ResourcePath: \"/opt/MAA\"}) // dir containing resource/","handlingStrategy":"validation","validationCode":"func validateResourcePath(p string) error {\n\tif p == \"\" {\n\t\treturn errors.New(\"ResourcePath is empty and cwd may not be the MAA root\")\n\t}\n\tinfo, err := os.Stat(filepath.Join(p, \"resource\"))\n\tif err != nil || !info.IsDir() {\n\t\treturn fmt.Errorf(\"no resource/ dir under %s\", p)\n\t}\n\treturn nil\n}","typeGuard":"func isMAAFalse(err error) bool { return errors.Is(err, maa.ErrorMAAFalse) }","tryCatchPattern":"m, err := maa.New(cfg)\nif errors.Is(err, maa.ErrorMAAFalse) {\n\tlog.Fatalf(\"resource load rejected by MAA core, check ResourcePath=%q\", cfg.ResourcePath)\n}","preventionTips":["Always set an absolute ResourcePath pointing at the MAA install dir containing resource/","Check resource dir existence in startup code before maa.New()","Keep MAA Core binary and resource versions in lockstep"],"tags":["maa","resource-loading","go","cgo"],"backgroundTag":"resource-load-failed","analyzedSha":"68e5200d0a787d88807b1516dd118af6d6fa0487","analyzedAt":"2026-09-01T04:33:15.058Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}