different-ai/openwork · error

Invalid timestamp: expected non-negative number, got ${msecs

Error message

Invalid timestamp: expected non-negative number, got ${msecs}

What it means

Error "Invalid timestamp: expected non-negative number, got ${msecs}" thrown in different-ai/openwork.

Source

Thrown at ee/packages/utils/src/typeid.ts:241

const typeIdWithTimestamp = <const T extends IdTypePrefixNames>(
  typeName: T,
  timestamp?: Date | number,
): TypeId<T> => {
  let msecs: number

  if (timestamp === undefined) {
    msecs = DateTime.now().toMillis()
  } else if (timestamp instanceof Date) {
    msecs = timestamp.getTime()
  } else {
    msecs = timestamp
  }

  if (!Number.isFinite(msecs)) {
    throw new Error(`Invalid timestamp: expected finite number, got ${msecs}`)
  }
  if (msecs < 0) {
    throw new Error(`Invalid timestamp: expected non-negative number, got ${msecs}`)
  }

  const uuid = uuidv7({ msecs })
  const prefix = idTypesMapNameToPrefix[typeName]
  return TypeID.fromUUID(prefix, uuid).toString() as TypeId<T>
}

const getColumnLength = <const T extends IdTypePrefixNames>(typeName: T) =>
  idTypesMapNameToPrefix[typeName].length + 1 + TYPE_ID_SUFFIX_LENGTH

export const typeId = {
  schema: typeIdZodSchema,
  generator: typeIdGenerator,
  generatorWithTimestamp: typeIdWithTimestamp,
  validator: validateTypeId,
  infer: inferTypeId,
  fromString: typeIdFromString,
  suffixLength: TYPE_ID_SUFFIX_LENGTH,

View on GitHub (pinned to 2b7df46e8a)

When it happens

Trigger: Thrown at ee/packages/utils/src/typeid.ts:241 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01). Data as JSON: /api/errors/65e1c06c5cf4bc63. Report an issue: GitHub.