hcengineering/platform · error · Error
sequence object not found
Error message
sequence object not found
What it means
Thrown in CreateApplication.svelte when the Sequence object for recruit.class.Applicant is missing. Sequences supply incrementing application numbers; without the sequence document the code cannot allocate a number and aborts creation.
Source
Thrown at plugins/recruit-resources/src/components/CreateApplication.svelte:123
isDone: false
}
const dispatch = createEventDispatcher()
const client = getClient()
const hierarchy = client.getHierarchy()
fillDefaults(hierarchy, doc, recruit.class.Applicant)
export function canClose (): boolean {
return (preserveCandidate || _candidate === undefined) && assignee === undefined
}
async function createApplication (): Promise<void> {
if (selectedState === undefined) {
throw new Error(`Please select initial state:${_space}`)
}
const sequence = await client.findOne(core.class.Sequence, { attachedTo: recruit.class.Applicant })
if (sequence === undefined) {
throw new Error('sequence object not found')
}
if (kind === undefined) {
throw new Error('kind is not specified')
}
const incResult = await client.update(sequence, { $inc: { sequence: 1 } }, true)
const candidateInstance = await client.findOne(contact.class.Person, { _id: _candidate })
if (candidateInstance === undefined) {
throw new Error('contact not found')
}
const ops = client.apply(undefined, recruitId + '.Create.CreateApplication')
if (!client.getHierarchy().hasMixin(candidateInstance, recruit.mixin.Candidate)) {
await ops.createMixin<Contact, Candidate>(
candidateInstance._id,
candidateInstance._class,View on GitHub (pinned to 63e28dc964)
Solutions
- Run workspace migrations/seed so the Applicant sequence object is created
- Re-create the sequence manually with attachedTo: recruit.class.Applicant
- Verify with a query that core.class.Sequence attachedTo=Applicant exists before opening the dialog
- Catch the error and trigger sequence seeding then retry
Example fix
// before
const sequence = await client.findOne(core.class.Sequence, { attachedTo: recruit.class.Applicant })
if (sequence === undefined) {
throw new Error('sequence object not found')
}
// after
let sequence = await client.findOne(core.class.Sequence, { attachedTo: recruit.class.Applicant })
if (sequence === undefined) {
sequence = await client.createDoc(core.class.Sequence, core.space.Model, {
attachedTo: recruit.class.Applicant, sequence: 0
})
} Defensive patterns
Strategy: validation
Validate before calling
const sequence = await client.findOne(core.class.Sequence, { attachedTo: recruit.class.Applicant })
if (sequence === undefined) {
await ensureSequence(recruit.class.Applicant, 0)
} Type guard
function hasSequence (s: Sequence | undefined): s is Sequence {
return s !== undefined
} Try / catch
try {
await createApplication()
} catch (err) {
if (err instanceof Error && err.message === 'sequence object not found') {
await seedSequences()
return createApplication()
}
throw err
} Prevention
- Seed sequences for all numbered classes in migrations
- Guard migrations to re-create missing sequences idempotently
- Do not delete core.space.Model documents during cleanups
- Smoke-test application creation on fresh workspaces
When it happens
Trigger: client.findOne(core.class.Sequence, { attachedTo: recruit.class.Applicant }) returns undefined because the sequence was never seeded, was deleted, or migrations have not run for the workspace.
Common situations: Fresh or partially-migrated recruit plugin workspace; sequence object removed by cleanup tooling; data restore that skipped sequence documents.
Related errors
- sequence object not found
- update is null
- Can only move accounts from mongodb for now
- Invalid region passed to migrate operation
- Add collection step must have attachedTo, attachedToClass, c
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/243f5313852e5c82.
Report an issue: GitHub.