MCPcopy Index your code
hub / github.com/simstudioai/sim / safeStart

Method safeStart

apps/sim/lib/logs/execution/logging-session.ts:775–831  ·  view source on GitHub ↗
(params: SessionStartParams)

Source from the content-addressed store, hash-verified

773 }
774
775 async safeStart(params: SessionStartParams): Promise<boolean> {
776 try {
777 await this.start(params)
778 return true
779 } catch (error) {
780 if (this.requestId) {
781 logger.warn(
782 `[${this.requestId}] Logging start failed - falling back to minimal session:`,
783 error
784 )
785 }
786
787 // Fallback: create a minimal logging session without full workflow state
788 try {
789 const { userId, workspaceId, variables, triggerData, deploymentVersionId, workflowState } =
790 params
791 this.trigger = createTriggerObject(this.triggerType, triggerData)
792 this.correlation = triggerData?.correlation
793 this.environment = createEnvironmentObject(
794 this.workflowId,
795 this.executionId,
796 userId,
797 workspaceId,
798 variables
799 )
800 const fallbackWorkflowState: WorkflowState = workflowState ?? {
801 blocks: {},
802 edges: [],
803 loops: {},
804 parallels: {},
805 }
806 this.workflowState = fallbackWorkflowState
807
808 await executionLogger.startWorkflowExecution({
809 workflowId: this.workflowId,
810 workspaceId,
811 executionId: this.executionId,
812 trigger: this.trigger,
813 environment: this.environment,
814 workflowState: this.workflowState,
815 deploymentVersionId,
816 })
817
818 if (this.requestId) {
819 logger.debug(
820 `[${this.requestId}] Started minimal logging for execution ${this.executionId}`
821 )
822 }
823 return true
824 } catch (fallbackError) {
825 if (this.requestId) {
826 logger.error(`[${this.requestId}] Minimal logging start also failed:`, fallbackError)
827 }
828 return false
829 }
830 }
831 }
832

Callers 6

handleExecutePostFunction · 0.95
executeWorkflowCoreFunction · 0.80
logPreprocessingErrorFunction · 0.80
route.tsFile · 0.80
route.tsFile · 0.80

Calls 7

startMethod · 0.95
createTriggerObjectFunction · 0.90
createEnvironmentObjectFunction · 0.90
debugMethod · 0.80
errorMethod · 0.80
warnMethod · 0.65

Tested by

no test coverage detected