@@ -169,6 +169,9 @@ private void UpdateFromRpcModel(RpcModel rpcModel)
169169 List < AgentViewModel > agents = [ ] ;
170170 foreach ( var agent in rpcModel . Agents )
171171 {
172+ if ( ! Uuid . TryFrom ( agent . Id . Span , out var uuid ) )
173+ continue ;
174+
172175 // Find the FQDN with the least amount of dots and split it into
173176 // prefix and suffix.
174177 var fqdn = agent . Fqdn
@@ -195,7 +198,7 @@ private void UpdateFromRpcModel(RpcModel rpcModel)
195198
196199 agents . Add ( _agentViewModelFactory . Create (
197200 this ,
198- agent . ParseId ( ) ,
201+ uuid ,
199202 fqdnPrefix ,
200203 fqdnSuffix ,
201204 connectionStatus ,
@@ -207,18 +210,23 @@ private void UpdateFromRpcModel(RpcModel rpcModel)
207210 // dummy agent row.
208211 foreach ( var workspace in rpcModel . Workspaces . Where ( w =>
209212 w . Status == Workspace . Types . Status . Stopped && ! workspacesWithAgents . Contains ( w . Id ) ) )
213+ {
214+ if ( ! Uuid . TryFrom ( workspace . Id . Span , out var uuid ) )
215+ continue ;
216+
210217 agents . Add ( _agentViewModelFactory . Create (
211218 this ,
212219 // Workspace ID is fine as a stand-in here, it shouldn't
213220 // conflict with any agent IDs.
214- workspace . ParseId ( ) ,
221+ uuid ,
215222 // We assume that it's a single-agent workspace.
216223 workspace . Name ,
217224 // TODO: this needs to get the suffix from the server
218225 ".coder" ,
219226 AgentConnectionStatus . Gray ,
220227 credentialModel . CoderUrl ,
221228 workspace . Name ) ) ;
229+ }
222230
223231 // Sort by status green, red, gray, then by hostname.
224232 ModelUpdate . ApplyLists ( Agents , agents , ( a , b ) =>
0 commit comments