{"record":{"id":"360c91f2b01b33db","repo":"stanfordnlp/CoreNLP","slug":"could-not-find-either-binaryname-or-te","errorCode":null,"errorMessage":"Could not find either \" + binaryName + \" or \" + textName","messagePattern":"Could not find either \" \\+ binaryName \\+ \" or \" \\+ textName","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/sentiment/ConvertMatlabModel.java","lineNumber":66,"sourceCode":"    if (!wordVectors.containsKey(source)) {\n      return;\n    }\n\n    wordVectors.put(target, new SimpleMatrix(wordVectors.get(source)));\n  }\n\n  public static SimpleMatrix loadMatrix(String binaryName, String textName) throws IOException {\n    File matrixFile = new File(binaryName);\n    if (matrixFile.exists()) {\n      return SimpleMatrix.loadBinary(matrixFile.getPath());\n    }\n\n    matrixFile = new File(textName);\n    if (matrixFile.exists()) {\n      return NeuralUtils.loadTextMatrix(matrixFile);\n    }\n\n    throw new RuntimeException(\"Could not find either \" + binaryName + \" or \" + textName);\n  }\n\n  public static void main(String[] args) throws IOException {\n    String basePath = \"/user/socherr/scr/projects/semComp/RNTN/src/params/\";\n    int numSlices = 25;\n\n    boolean useEscapedParens = false;\n\n    for (int argIndex = 0; argIndex < args.length; ) {\n      if (args[argIndex].equalsIgnoreCase(\"-slices\")) {\n        numSlices = Integer.parseInt(args[argIndex + 1]);\n        argIndex += 2;\n      } else if (args[argIndex].equalsIgnoreCase(\"-path\")) {\n        basePath = args[argIndex + 1];\n        argIndex += 2;\n      } else if (args[argIndex].equalsIgnoreCase(\"-useEscapedParens\")) {\n        useEscapedParens = true;\n        argIndex += 1;","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/sentiment/ConvertMatlabModel.java#L48-L84","documentation":"ConvertMatlabModel.loadMatrix looks for a matrix file in binary (binaryName) or text (textName) form under the base path; if neither file exists it throws RuntimeException. It is a hard failure because the model cannot be converted without the source matrix data.","triggerScenarios":"Calling loadMatrix (directly or via main/W/Wcat/combinedWV conversion) with a basePath or matrix name where neither <name>.bin-style binary file nor the text file exists.","commonSituations":"Hard-coded basePath (/user/socherr/scr/...) pointing to a path that does not exist on your machine; wrong matrix name; data files not copied along with the code.","solutions":["Place the matrix files (binary or text) under the expected basePath with the expected names","Edit the basePath/naming in ConvertMatlabModel (or its caller) to point at where your files actually are","Check file existence and permissions before running, e.g. ls the directory"],"exampleFix":"// before\nString basePath = \"/user/socherr/scr/projects/semComp/RNTN/src/params/\";\n// after\nString basePath = \"/data/rntn/params/\"; // actual location of W.txt, U.txt etc.","handlingStrategy":"validation","validationCode":"for (String name : new String[]{\"W\", \"Wcat\", \"U\", \"combinedWV\"}) {\n  File bin = new File(basePath, name + binaryExt);\n  File txt = new File(basePath, name + \".txt\");\n  if (!bin.exists() && !txt.exists()) throw new FileNotFoundException(name + \" missing in \" + basePath);\n}","typeGuard":"static boolean matrixAvailable(String base, String name) {\n  return new File(base, name + \".bin\").exists() || new File(base, name + \".txt\").exists();\n}","tryCatchPattern":"try {\n  ConvertMatlabModel.main(args);\n} catch (RuntimeException e) {\n  log.error(\"Model matrix files missing: \" + e.getMessage());\n}","preventionTips":["Replace the hard-coded basePath with a configurable path/argument","Verify all expected matrix files exist before running conversion","Copy model parameter files alongside the code when moving machines"],"tags":["file","sentiment","model"],"backgroundTag":"file-not-found","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}