hcengineering/platform · error · Error
Please select initial state:${_space}
Error message
Please select initial state:${_space} What it means
Thrown in MoveApplication.svelte when `selectedState` is undefined while moving an application to another space. The application must be assigned a state in the destination space, so the update aborts. Notably the function duplicates the same check twice; the second (unreachable) copy shows the intended 'state not found space:' message.
Source
Thrown at plugins/recruit-resources/src/components/MoveApplication.svelte:62
import VacancyCard from './VacancyCard.svelte'
import VacancyOrgPresenter from './VacancyOrgPresenter.svelte'
export let selected: Applicant[]
const status: Status = OK
let _space = selected[0]?.space
const dispatch = createEventDispatcher()
const client = getClient()
export function canClose (): boolean {
return true
}
async function updateApplication () {
if (selectedState === undefined) {
throw new Error(`Please select initial state:${_space}`)
}
if (selectedState === undefined) {
throw new Error(`create application: state not found space:${_space}`)
}
const op = client.apply(undefined, 'application.states')
for (const a of selected) {
await moveToSpace(op, a, _space, { status: selectedState._id })
}
await op.commit()
dispatch('close')
}
let states: Array<{ id: number | string, color: number, label: string }> = []
let selectedState: TaskStatus | undefined
let rawStates: TaskStatus[] = []
const spaceQuery = createQuery()View on GitHub (pinned to 63e28dc964)
Solutions
- Select a state for the destination space before confirming the move
- Ensure the target space has states configured/inherited from its project type
- Disable the move button until selectedState is defined
- Remove the duplicated check and catch the error to show a friendly prompt
Example fix
// before
if (selectedState === undefined) {
throw new Error(`Please select initial state:${_space}`)
}
if (selectedState === undefined) {
throw new Error(`create application: state not found space:${_space}`)
}
// after
if (selectedState === undefined) {
ui.notify(`Please select a state in ${_space} before moving`)
return
} Defensive patterns
Strategy: validation
Validate before calling
if (selectedState === undefined) {
ui.notify(`Select a state in ${_space} before moving`)
return
}
await updateApplication() Type guard
function hasState (state: Ref<DomainState> | undefined): state is Ref<DomainState> {
return state !== undefined
} Try / catch
try {
await updateApplication()
} catch (err) {
if (err instanceof Error && err.message.startsWith('Please select initial state')) {
ui.notify('Choose a destination state to complete the move.')
} else throw err
} Prevention
- Preselect a default state when opening the move dialog
- Load destination space states before enabling confirm
- Remove the duplicated selectedState check
- Validate states whenever the target space changes
When it happens
Trigger: User confirms the move dialog without choosing a target state; the destination space's states have not loaded or the space has no states configured so the selector remains empty.
Common situations: Destination vacancy/project without a set-up state machine; UI permitting submit on an empty selector; async state loading that has not resolved when the user clicks move.
Related errors
- Please select initial state:${_space}
- kind is not specified
- kind is not specified
- Failed to load server config
- getDisplayMedia not supported
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/1e74e8393fef406b.
Report an issue: GitHub.