microsoft/FASTER · error

uuid_parse returned

Error message

uuid_parse returned %d

What it means

In Guid::Parse, on non-Windows platforms the string is parsed with libuuid's uuid_parse; if it returns non-zero, the input string was not a valid UUID/GUID in the expected textual format. The library logs the return code and then hits assert(result == 0), so in debug builds this aborts the process and in release builds it returns a garbage/uninitialized uuid_t. This means the caller passed a malformed identifier string.

Solutions

  1. Validate the string with a regex like ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$ before calling Parse
  2. Strip enclosing braces, quotes, and whitespace from GUID strings taken from Windows sources or user input
  3. Normalize the case with std::tolower and ensure hyphen positions match the 8-4-4-4-12 layout expected by uuid_parse
  4. Log the offending string (not just the return code) so the malformed source can be identified and fixed

Example fix

// before
Guid g = Guid::Parse(guidString); // may abort on '{...}' style input
// after
std::string s = guidString;
s.erase(std::remove(s.begin(), s.end(), '{'), s.end());
s.erase(std::remove(s.begin(), s.end(), '}'), s.end());
if (!std::regex_match(s, std::regex("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"))) {
  throw std::invalid_argument("Invalid GUID string: " + s);
}
Guid g = Guid::Parse(s);
Defensive patterns

Strategy: validation

Validate before calling

static const std::regex kGuidRe("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$");
std::string s = input;
s.erase(std::remove_if(s.begin(), s.end(), [](char c){ return c=='{' || c=='}' || std::isspace((unsigned char)c); }), s.end());
bool valid = std::regex_match(s, kGuidRe);

Type guard

bool IsValidGuidString(const std::string& s) {
  std::string t;
  for (char c : s) if (c != '{' && c != '}' && !std::isspace((unsigned char)c)) t += c;
  return std::regex_match(t, std::regex("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"));
}

Prevention

When it happens

Trigger: Calling Guid::Parse (directly or via helpers that parse checkpoint/token strings) with a string that is not exactly 36 characters of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, e.g. a GUID string produced on Windows with braces '{...}', a bare hex string without hyphens, an empty string, or a truncated value read from a corrupted config or checkpoint file.

Common situations: Windows-to-Linux portability: GUIDs serialized with the Windows '{XXXXXXXX-...}' or uppercase/braced formats that libuuid rejects; user-supplied FASTER index/checkpoint GUIDs pasted with surrounding whitespace or quotes; reading GUIDs from files that were hand-edited or truncated.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.


AI-assisted analysis of microsoft/FASTER@321d872eab (2026-09-15). Data as JSON: /api/errors/c91c18cb4cb9ef62. Report an issue: GitHub.

Appendix: source

Thrown at cc/src/core/guid.h:68

#else
    uuid_t uuid;
    uuid_generate(uuid);
    return uuid;
#endif
  }

  static Guid Parse(const std::string str) {
#ifdef _WIN32
    GUID guid;
    auto result = ::UuidFromString(reinterpret_cast<uint8_t*>(const_cast<char*>(str.c_str())),
                                   &guid);
    assert(result == RPC_S_OK);
    return guid;
#else
    uuid_t uuid;
    int result = uuid_parse(const_cast<char*>(str.c_str()), uuid);
    if (result) {
      log_error("uuid_parse returned %d", result);
    }
    assert(result == 0);
    return uuid;
#endif
  }

  static bool IsNull(Guid guid) {
#ifdef _WIN32
    return guid == GUID_NULL;
#else
    return uuid_is_null(guid.uuid_);
#endif
  }

  void Clear() {
#ifdef _WIN32
    guid_.Data1 = 0;
    guid_.Data2 = 0;

View on GitHub (pinned to 321d872eab)